Part Number Hot Search : 
SK3415K AD7870JN AD7870JN M94RCA 1604FA GM2115 R322U01 1N6842U3
Product Description
Full Text Search
 

To Download ADE7116 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  single-phase energy measurement ic with 8052 mcu, rtc, and lcd driver ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b information furnished by analog devices is believed to be accurate and reliable. however, no responsibility is assumed by analog devices for its use, nor for any infringements of patents or other rights of third parties that may result from its use. specifications subject to change without notice. no license is granted by implication or otherwise under any patent or patent rights of analog devices. trademarks and registered trademarks are the property of their respective owners. one technology way, p.o. box 9106, norwood, ma 02062-9106, u.s.a. tel: 781.329.4700 www.analog.com fax: 781.461.3113 ?2007C2008 analog devices, inc. all rights reserved. general features wide supply voltage operation: 2.4 v to 3.7 v internal bipolar switch between regulated and battery inputs ultralow power operation with power saving modes (psm) full operation: 4 ma to 1.6 ma (pll clock dependent) battery mode: 3.2 ma to 400 a (pll clock dependent) sleep mode real-time clock (rtc) mode: 1.5 a rtc and lcd mode: 38 a (lcd charge pump enabled) reference: 1.2 v 0.1% (10 ppm/c drift) 64-lead rohs package options lead frame chip scale package (lfcsp) low profile quad flat package (lqfp) operating temperature range: ?40c to +85c energy measurement features proprietary analog-to-digital converters (adcs) and digital signal processing (dsp) provide high accuracy active (watt), reactive (var), and apparent energy (volt-ampere (va)) measurement <0.1% error on active energy over a dynamic range of 1000 to 1 @ 25c <0.5% error on reactive energy over a dynamic range of 1000 to 1 @ 25c (ade7169 and ade7569 only) <0.5% error on root mean square (rms) measurements over a dynamic range of 500 to 1 for current (i rms ) and 100 to 1 for voltage (v rms ) @ 25c supports iec 62053-21, iec 62053-22, and iec 62053-23; en 50470-3 class a, class b, and class c; and ansi c12-16 differential input with programmable gain amplifiers (pgas) supports shunts, current transformers, and di/dt current sensors (ade7169 and ade7569 only) 2 current inputs for antitamper detection in the ADE7116/ade7156/ade7166/ade7169 high frequency outputs proportional to i rms , active, reactive, or apparent power (ap) table 1. features available on each part feature part no. antitamper ADE7116, ade7156, ade7166, ade7169 watt, va, i rms , v rms ADE7116, ade7156, ade7166, ade7169, ade7566, ade7569 var ade7169, ade7569 di/dt sensor ade7169, ade7569 microprocessor features 8052-based core single-cycle 4 mips 8052 core 8052-compatible instruction set 32.768 khz external crystal with on-chip pll 2 external interrupt sources external reset pin low power battery mode wake-up from i/o, temperature change 1 , alarm, and universal asynchronous receiver/transmitter (uart) lcd driver operation temperature measurement real-time clock (rtc) counter for seconds, minutes, and hours automatic battery switchover for rtc backup operation down to 2.4 v ultralow battery supply current: 1.5 a selectable output frequency: 1 hz to 16 khz embedded digital crystal frequency compensation for calibration and temperature variation of 2 ppm resolution integrated lcd driver 108-segment driver for the ade7566/ade7569 and 104-segment driver for the ADE7116/ade7156/ ade7166/ade7169 2, 3, or 4 multiplexing lcd voltages generated internally 2 or with external resistors internal adjustable drive voltages up to 5 v independent of power supply level 2 on-chip peripherals uart interface spi or i 2 c watchdog timer power supply management with user-selectable levels memory: 16 kb flash memory, 512 bytes ram development tools single-pin emulation ide-based assembly and c-source debugging 1 not available in the ADE7116. 2 not available in the ADE7116 or ade7156.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 2 of 15 2 table of contents general features ............................................................................... 1 ? energy measurement features ........................................................ 1 ? microprocessor features .................................................................. 1 ? revision history ............................................................................... 3 ? general description ......................................................................... 4 ? functional block diagrams ............................................................. 4 ? specifications ..................................................................................... 6 ? energy metering ........................................................................... 6 ? analog peripherals ....................................................................... 7 ? digital interface ............................................................................ 8 ? timing specifications ................................................................ 10 ? absolute maximum ratings .......................................................... 15 ? thermal resistance .................................................................... 15 ? esd caution ................................................................................ 15 ? pin configurations and function descriptions ......................... 16 ? typical performance characteristics ........................................... 22 ? performance curves for the ade7169 and ade7569 only 25 ? terminology .................................................................................... 26 ? special function register (sfr) mapping .................................. 27 ? power management ........................................................................ 29 ? power management register details ....................................... 29 ? power supply architecture ........................................................ 32 ? battery switchover ...................................................................... 32 ? power supply management (psm) interrupt ......................... 33 ? using the power supply features ............................................. 35 ? operating modes ............................................................................ 37 ? psm0 (normal mode) ............................................................... 37 ? psm1 (battery mode) ................................................................ 37 ? psm2 (sleep mode) .................................................................... 37 ? 3.3 v peripherals and wake-up events ................................... 38 ? transitioning between operating modes ............................... 39 ? using the power management features .................................. 39 ? energy measurement ..................................................................... 40 ? access to energy measurement sfrs ...................................... 40 ? access to internal energy measurement registers ................ 40 ? energy measurement registers ................................................ 43 ? energy measurement internal register details ..................... 44 ? interrupt status/enable sfrs .................................................... 47 ? analog inputs .............................................................................. 49 ? analog-to-digital conversion .................................................. 50 ? fault detection ........................................................................... 54 ? di/dt current sensor and digital integrator for the ade7169/ade7569 ................................................................... 55 ? power quality measurements ................................................... 57 ? phase compensation ................................................................. 59 ? rms calculation ........................................................................ 59 ? active power calculation .......................................................... 62 ? active energy calculation ........................................................ 64 ? reactive power calculation (ade7169/ade7569) .............. 67 ? reactive energy calculation (ade7169/ade7569) ............. 68 ? apparent power calculation ..................................................... 72 ? apparent energy calculation ................................................... 73 ? ampere-hour accumulation ................................................... 74 ? energy-to-frequency conversion............................................ 75 ? energy register scaling ............................................................. 76 ? energy measurement interrupts .............................................. 76 ? temperature, battery, and supply voltage measurements........ 77 ? temperature measurement ....................................................... 79 ? battery measurement ................................................................. 79 ? external voltage measurement ................................................ 80 ? 8052 mcu core architecture....................................................... 82 ? mcu registers ............................................................................ 82 ? basic 8052 registers ................................................................... 84 ? standard 8052 sfrs .................................................................... 85 ? memory overview ..................................................................... 85 ? addressing modes ...................................................................... 86 ? instruction set ............................................................................ 88 ? read-modify-write instructions ............................................. 90 ? instructions that affect flags .................................................. 90 ? dual data pointers ......................................................................... 92 ? interrupt system ............................................................................. 93 ? standard 8052 interrupt architecture ..................................... 93 ? interrupt architecture ............................................................... 93 ? interrupt registers...................................................................... 93 ? interrupt priority ........................................................................ 94 ? interrupt flags ............................................................................ 95 ? interrupt vectors ........................................................................ 97 ? interrupt latency ........................................................................ 97 ? context saving ............................................................................ 97 ? watchdog timer ............................................................................. 98 ?
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 3 of 152 lcd driver ................................................................................... 100 ? lcd registers ........................................................................... 100 ? lcd setup ................................................................................. 103 ? lcd timing and waveforms ................................................. 103 ? blink mode ................................................................................ 104 ? display element control ......................................................... 104 ? voltage generation .................................................................. 105 ? lcd external circuitry ........................................................... 106 ? lcd function in psm2 mode ............................................... 106 ? flash memory ............................................................................... 108 ? flash memory overview ......................................................... 108 ? flash memory organization ................................................... 109 ? using the flash memory ......................................................... 109 ? protecting the flash memory ................................................. 113 ? in-circuit programming ......................................................... 114 ? timers ............................................................................................ 115 ? timer registers ......................................................................... 115 ? timer 0 and timer 1 ................................................................ 117 ? timer 2 ...................................................................................... 118 ? pll ................................................................................................. 120 ? pll registers ............................................................................ 120 ? real-time clock (rtc) .............................................................. 121 ? rtc sfrs .................................................................................. 121 ? read and write operations .................................................... 124 ? rtc modes ............................................................................... 124 ? rtc interrupts ......................................................................... 124 ? rtc calibration ........................................................................ 125 ? uart serial interface ................................................................... 126 ? uart sfrs ................................................................................ 126 ? uart operation modes .......................................................... 129 ? uart baud rate generation .................................................. 130 ? uart additional features ...................................................... 132 ? serial peripheral interface (spi) .................................................. 133 ? spi registers .............................................................................. 133 ? spi pins ....................................................................................... 136 ? spi master operating modes .................................................. 137 ? spi interrupt and status flags ................................................. 138 ? i 2 c-compatible interface ............................................................. 139 ? serial clock generation ........................................................... 139 ? slave addresses .......................................................................... 139 ? i 2 c registers ............................................................................... 139 ? read and write operations ..................................................... 140 ? i 2 c receive and transmit fifos ............................................. 141 ? i/o ports ......................................................................................... 142 ? parallel i/o ................................................................................. 142 ? i/o registers .............................................................................. 143 ? port 0 ........................................................................................... 146 ? port 1 ........................................................................................... 146 ? port 2 ........................................................................................... 146 ? determining the version of the part .......................................... 147 ? outline dimensions ...................................................................... 148 ? ordering guide ......................................................................... 149 ? revision history 11/08rev. a to rev. b added ADE7116/ade7156 ......................................... throughout changes to table 1 ............................................................................ 1 added figure 2 .................................................................................. 5 changes to table 13 ........................................................................ 16 added figure 10 and table 14; renumbered sequentially ........ 19 added exposed pad notation to outline dimensions ............148 changes to ordering guide .........................................................149 12/07rev. 0 to rev. a added ade7166/ade7169 .............................................. universal changes to table 1 ............................................................................ 1 changes to ordering guide .........................................................144 11/07revision 0: initial version
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 4 of 152 general description the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 1 integrate the analog devices, inc., energy (ade) metering ic analog front end and fixed function dsp solution with an enhanced 8052 mcu core, an rtc, an lcd driver, and all the peripherals to make an electronic energy meter with an lcd display in a single part. the ade measurement core includes active, reactive, and apparent energy calculations, as well as voltage and current rms measure- ments. this information is accessible for energy billing by using the built-in energy scalars. many power line supervisory features such as sag, peak, and zero crossing are included in the energy measurement dsp to simplify energy meter design. the microprocessor functionality includes a single-cycle 8052 core, a real-time clock with a power supply backup pin, an spi or i 2 c? interface, and a uart interface. the ready-to-use infor- mation from the ade core reduces the program memory size requirement, making it easy to integrate complicated design into 16 kb of flash memory. the ADE7116/ade7156/ade7 166/ade7169/ade7566/ ade7569 also include a 108-/104-segment lcd driver. in the ade7166/ade7169/ade7566/ade7569, this driver generates voltages capable of driving lcds up to 5 v. 1 patents pending. functional block diagrams i p i n v p v n r e f i n / o u t energy measurement dsp osc com0 ... ... com3 . . . c f 1 c f 2 ldo 3v/5v lcd charge pump single cycle 8052 mcu ade7566/ade7569 fp26 v d c i n v bat v d d v s w o u t v i n t d v i n t a r e s e t dgnd a gnd t x d uart serial port lcdva lcdvb lcdvc . . . fp0 fp15 rtc s s s c l k m i s o m o s i / s d a t a r x d s d e n t 2 t 2 e x t 0 t 1 lcdvp2 x t a l 2 x t a l 1 i n t 0 i n t 1 fp16 fp17 fp23 fp22 fp21 fp20 fp19 fp18 fp25 fp24 1.20v ref 52 53 55 49 50 63 54 58 64 61 60 62 56 51 44 36 37 46 47 48 45 5 fp28 fp27 2 1 6 7 8 9 10 11 12 13 14 20 35 1 4 15 17 18 16 57 43 42 39 38 7 6 38 39 40 41 59 pga2 ? + pga1 ? + adc adc temp adc vdcin adc program memory 16kb flash power supply control and monitoring user ram 256 bytes user xram 256 bytes temp sensor battery adc spi/i 2 c serial interface 3 16-bit counter timers 108-segment lcd driver watchdog timer downloader debugger pll 1-pin emulator ldo ea uart timer por 06353-001 44 14 13 12 45 11 43 42 41 40 39 38 37 36 5 6 7 8 9 10 p0 .7/ss/t1 p0.6 /sclk/t0 p0. 5/miso p0 .4/mosi/sda ta p0. 0 (bctrl/in t1/p0.0) p1.0/rxd p1.1 /txd p1.2/fp25 p1.3/t2ex/f p24 p1.6/fp 21 p1.7 /fp20 p1.4/t 2/fp23 p1.5/fp22 p0 .1/fp19 p0 .2/cf1/rtcc al p 0.3/cf2 p2.0/fp18 p2.1/fp17 p2.2/fp16 p2.3 (sden/p2.3) figure 1. ade7566/ade7569 functional block diagram
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 5 of 152 adc i pa i n i pb r e f i n / o u t energy measurement dsp osc com0 ... ... com3 . . . c f 1 c f 2 ldo 3v/5v lcd charge pump single cycle 8052 mcu ADE7116/ade7156/ade7166/ade7169 v d c i n v bat v d d v s w o u t v i n t d v i n t a r e s e t dgnd a gnd t x d uart serial port lcdva lcdvb lcdvc . . . fp0 fp15 rtc s s s c l k m i s o m o s i / s d a t a r x d s d e n t 2 t 2 e x t 0 t 1 lcdvp1 lcdvp2 x t a l 2 x t a l 1 i n t 0 i n t 1 fp16 fp17 fp23 fp22 fp21 fp20 fp19 fp18 fp25 fp24 1.20v ref 52 53 55 v p v n 49 63 54 58 64 61 60 62 56 51 44 36 37 46 47 48 45 5 6 7 8 9 10 11 12 13 14 20 35 1 4 15 17 18 16 19 57 43 42 39 38 7 6 38 39 40 41 59 pga1 ? + adc 50 pga2 ? + pga1 ? + adc temp adc vdcin adc program memory 16kb flash power supply control and monitoring user ram 256 bytes user xram 256 bytes temp sensor battery adc spi/i 2 c serial interface 3 16-bit counter timers 104-segment lcd driver watchdog timer downloader debugger pll 1-pin emulator ldo ea uart timer por 06353-119 44 14 13 12 45 11 43 42 41 40 39 38 37 36 5 6 7 8 9 10 p0.7/ss /t1 p0.6/scl k/t0 p0.5/mis o p0.4/mo si/sdata p0.0 (bct rl/int1/p0 .0 ) p 1.0/rxd p 1 .1/txd p1.2 /fp25 p1.3 /t2ex/fp24 p1.6/fp21 p1.7/fp 20 p1.4/t2/fp 23 p1.5 /fp22 p0.1/fp1 9 p0.2/cf1 /rtccal p0.3/cf 2 p2.0/fp18 p2.1/fp17 2 1 fp27 fp28 p2.2/fp16 p2.3 (sden/p2.3) figure 2. ADE7116/ade7156/ade7166/ade7169 functional block diagram
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 6 of 152 specifications v dd = 3.3 v 5%, agnd = dgnd = 0 v, on-chip reference xtalx = 32.768 khz, t min to t max = ?40c to +85c, unless otherwise noted. energy metering table 2. parameter min typ max unit test conditions/comments measurement accuracy 1 phase error between channels 2 pf = 0.8 capacitive 0.05 degrees phase lead: 37 pf = 0.5 inductive 0.05 degrees phase lag: 60 active energy measurement error 2 0.1 % of reading over a dynamic range of 1000 to 1 at 25c ac power supply rejection 2 v dd = 3.3 v + 100 mv rms/120 hz output frequency variation 0.01 % i px = v p = 100 mv rms dc power supply rejection 2 v dd = 3.3 v 117 mv dc output frequency variation 0.01 % active energy measurement bandwidth 1 8 khz reactive energy measurement error 2 , 3 0.5 % of reading over a dynamic range of 1000 to 1 at 25c v rms measurement error 2 0.5 % of reading over a dynamic range of 100 to 1 at 25c v rms measurement bandwidth 1 3.9 khz i rms measurement error 2 0.5 % of reading over a dynamic range of 500 to 1 at 25c i rms measurement bandwidth 1 3.9 khz analog inputs maximum signal levels 400 mv peak v p ? v n differential input ade7566/ade7569 400 mv peak i p ? i n differential input ADE7116/ade7156/ade7166/ade7169 250 mv peak i pa ? i n and i pb ? i n differential inputs input impedance (dc) 770 k adc offset error 2 10 mv pga1 = pga2 = 1 1 mv pga1 = 16 gain error 2 current channel 3 % i pa = i pb = 0.4 v dc or i p = 0.4 v dc voltage channel 3 +3 % v p ? v n = 0.4 v dc gain error match 0.2 % cf1 and cf2 pulse output maximum output frequency 13.5 khz v p ? v n = 400 mv peak, i pa ? i n = 250 mv, pga1 = 2 sine wave duty cycle 50 % if cf1 or cf2 frequency, >5.55 hz active high pulse width 90 ms if cf1 or cf2 frequency, <5.55 hz fault detec tion 4 fault detection threshold inactive input active input 6.25 % of active i pa or i pb active input swap threshold inactive input > active input 6.25 % of active i pa or i pb active accuracy fault mode operation i pa active, i pb = agnd 0.1 % of reading over a dynamic range of 500 to 1 i pb active, i pa = agnd 0.1 % of reading over a dynamic range of 500 to 1 fault detection delay 3 seconds swap delay 3 seconds 1 these specifications are not production tested but are guaranteed by design and/or characterization data on production release . 2 see the terminology section for definition. 3 this function is not availab le in the ade7166 or ade7566. 4 this function is not availab le in the ade7566 or ade7569.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 7 of 152 analog peripherals table 3. parameter min typ max unit test conditions/comments internal adcs (battery, temperature, v dcin ) 1 power supply operating range 2.4 3.7 v measured on v swout no missing codes 2 8 bits conversion delay 3 38 s adc gain v dcin measurement 15.3 mv/lsb v bat measurement 14.6 mv/lsb temperature measurement 0.78 c/lsb adc offset v dcin measurement at 3 v 206 lsb v bat measurement at 3.7 v 205 lsb temperature measurement at 25c 129 lsb v dcin analog input maximum signal levels 0 3.3 v input impedance (dc) 1 m low v dcin detection threshold 1.09 1.2 1.27 v power-on reset (por) v dd por detection threshold 2.5 2.95 v por active timeout period 33 ms v swout por detection threshold 1.8 2.2 v por active timeout period 20 ms v intd por detection threshold 2.0 2.25 v por active timeout period 16 ms v inta por detection threshold 2.05 2.25 v por active timeout period 120 ms battery switchover voltage operating range (v swout ) 2.4 3.7 v v dd to v bat switching switching threshold (v dd ) 2.5 2.95 v switching delay 10 ns when v dd to v bat switch activated by v dd 30 ms when v dd to v bat switch activated by v dcin v bat to v dd switching switching threshold (v dd ) 2.5 2.95 v switching delay 30 ms based on v dd > 2.75 v v swout to v bat leakage current 10 na v bat = 0 v, v swout = 3.43 v, t a = 25c lcd, charge pump active 4 charge pump capacitance between lcdvp1 and lcdvp2 100 nf lcdva, lcdvb, lcdvc decoupling capacitance 470 nf lcdva 0 1.75 v lcdvb 0 3.5 v 1/3 bias mode lcdvc 0 5.3 v 1/3 bias mode v1 segment line voltage lcdva ? 0.1 lcdva v current on segment line = ?2 a v2 segment line voltage lcdvb ? 0.1 lcdvb v current on segment line = ?2 a v3 segment line voltage lcdvc ? 0.1 lcdvc v current on segment line = ?2 a dc voltage across segment and comx pin 50 mv lcdvc ? lcdvb, lcdvc ? lcdva, or lcdvb ? lcdva
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 8 of 152 parameter min typ max unit test conditions/comments lcd, resistor ladder active leakage current 20 na 1/2 and 1/3 bias modes, no load v1 segment line voltage lcdva ? 0.1 lcdva v current on segment line = ?2 a v2 segment line voltage lcdvb ? 0.1 lcdvb v current on segment line = ?2 a v3 segment line voltage lcdvc ? 0.1 lcdvc v current on segment line = ?2 a on-chip reference reference error 0.9 mv t a = 25c power supply rejection 80 db temperature coefficient 2 10 50 ppm/c 1 this function is not available in the ADE7116. 2 these specifications are not production tested but are guaranteed by design and/or characterization data on production release . 3 delay between adc conversion request and interrupt set. 4 this function is not availab le in the ADE7116 or ade7156. digital interface table 4. parameter min typ max unit test conditions/comments logic inputs 1 all inputs except xtal1, xtal2, bctrl, int0 , int1 , reset input high voltage, v inh 2.0 v input low voltage, v inl 0.8 v bctrl, int0 , int1 , reset input high voltage, v inh 1.3 v input low voltage, v inl 0.8 v input currents reset 100 na reset = v swout = 3.3 v port 0, port 1, port 2 100 na internal pull-up disabled, input = 0 v or v swout ?3.75 ?8.5 a internal pull-up enabled, input = 0 v, v swout = 3.3 v input capacitance 10 pf all digital inputs flash memory endurance 2 20,000 cycles data retention 3 20 years t j = 85c crystal oscillator 4 crystal equivalent series resistance 30 50 k crystal frequency 32 32.768 33.5 khz xtal1 input capacitance 12 pf xtal2 output capacitance 12 pf mcu clock rate (f core ) 4.096 mhz crystal = 32.768 khz and cd bits = 000 32 khz crystal = 32.768 khz and cd bits = 111 logic outputs output high voltage, v oh 2.4 v v dd = 3.3 v 5% i source 80 a output low voltage, v ol 5 0.4 v v dd = 3.3 v 5% i sink 2 ma start-up time 6 psm0 power-on time 880 ms v dd at 2.75 v to psm0 code execution from power saving mode 1 (psm1) psm1 to psm0 130 ms v dd at 2.75 v to psm0 code execution from power saving mode 2 (psm2) psm2 to psm1 48 ms wake-up event to psm1 code execution psm2 to psm0 186 ms v dd at 2.75 v to psm0 code execution
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 9 of 152 parameter min typ max unit test conditions/comments power supply inputs v dd 3.13 3.3 3.46 v v bat 2.4 3.3 3.7 v internal power supply switch (v swout ) v bat to v swout on resistance 22 v bat = 2.4 v v dd to v swout on resistance 10.2 v dd = 3.13 v v bat to/from v dd switching open time 40 ns bctrl state change and switch delay 18 s v swout output current drive 6 ma power supply outputs v inta 2.3 2.70 v v intd 2.3 2.70 v v inta power supply rejection 60 db v intd power supply rejection 50 db power supply currents current in normal mode (psm0) 4 5.3 ma f core = 4.096 mhz, lcd and meter active 2.1 ma f core = 1.024 mhz, lcd and meter active 1.6 ma f core = 32.768 khz, lcd and meter active 3 3.9 ma f core = 4.096 mhz, metering adc and dsp powered down current in psm1 3.2 5.05 ma f core = 4.096 mhz, lcd active, v bat = 3.7 v 880 a f core = 1.024 mhz, lcd active current in psm2 38 a lcd active with charge pump at 3.3 v + rtc, v bat = 3.3 v 1.5 a rtc only, t a = 25c, v bat = 3.3 v 1 specifications guaranteed by design. 2 endurance is qualified as per jedec standard 22 method a117 and measured at ?40c, +25c, +85c, and +125c. 3 retention lifetime equivalent at junction temperature (t j ) = 85c as per jedec standard 22 method a117. retention lifetime derates with junction temperature. 4 recommended crysta l specifications. 5 test carried out with all the i/os set to a low output level. 6 delay between power supply valid and exec ution of first instruction by 8052 core.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 10 of 1 52 timing specifications ac inputs during testing were driven at v swout ? 0.5 v for logic 1 and at 0.45 v for logic 0. timing measurements were made at v ih minimum for logic 1 and at v il maximum for logic 0, as shown in figure 3 . for timing purposes, a port pin is no longer floating when a 100 mv change from load voltage occurs. a port pin begins to float when a 100 mv change from the loaded v oh /v ol level occurs, as shown in figure 3 . c load for all outputs is equal to 80 pf, unless otherwise noted. v dd = 2.7 v to 3.6 v; all specifications t min to t max , unless otherwise noted. v swout ? 0.5 v 0.45v 0.2v swout + 0.9v test points 0.2v swout ? 0.1v v load ? 0.1v v load v load + 0.1v timing reference points v load ? 0.1v v load v load ? 0.1v 06353-002 figure 3. timing waveform characteristics table 5. clock input (external clock driven xtal1) parameter 32.768 khz external crystal parameter description min typ max unit t ck xtal1 period 30.52 s t ckl xtal1 width low 6.26 s t ckh xtal1 width high 6.26 s t ckr xtal1 rise time 9 ns t ckf xtal1 fall time 9 ns 1/t core core clock frequency 1 1.024 mhz 1 the internal pll locks onto a multiple ( 512) of the 32.768 khz external crystal freq uency to provide a stable 4.096 mhz inter nal clock for the system. the core can operate at this frequency or at a binary submultiple defined by the cd bits of the powcon sfr, address 0xc5[2:0] (see table 26) . table 6. i 2 c-compatible interface timi ng parameters (400 khz) parameter description typ unit t buf bus-free time between stop condition and start condition 1.3 s t l sclk low pulse width 1.36 s t h sclk high pulse width 1.14 s t shd start condition hold time 251.35 s t dsu data setup time 740 ns t dhd data hold time 400 ns t rsu setup time for repeated start 12.5 ns t psu stop condition setup time 400 ns t r rise time of both sclk and sdata 200 ns t f fall time of both sclk and sdata 300 ns t sup 1 pulse width of spike suppressed 50 ns 1 input filtering on both the sclk and sdata inputs suppresses noise spikes of <50 ns. msb t buf sdata (i/o) sclk (i) stop condition start condition repeated start lsb ack msb 1 2to 7 89 1 s(r) ps t psu t dsu t shd t dhd t sup t dsu t dhd t h t sup t l t rsu t r t r t f t f 0 6353-003 figure 4. i 2 c-compatible in terface timing
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 11 of 1 52 table 7. spi master mode timi ng (spicpha = 1) parameters parameter description min typ max unit t sl sclk low pulse width 2 spir t core 1 ns t sh sclk high pulse width 2 spir t core 1 ns t dav data output valid after sclk edge 3 t core 1 ns t dsu data input setup time before sclk edge 0 ns t dhd data input hold time after sclk edge t core 1 ns t df data output fall time 19 ns t dr data output rise time 19 ns t sr sclk rise time 19 ns t sf sclk fall time 19 ns 1 t core depends on the clock divider or cd[2:0] bits of the powcon sfr, address 0xc5 (see table 26); t core = 2 cd /4.096 mhz. sclk (spicpol = 0) t dsu sclk (spicpol = 1) mosi miso msb lsb lsb in bits [6:1] bits [6:1] t dhd t dr t dav t df t sh t sl t sr t sf msb in 06353-004 figure 5. spi master mode timing (spicpha = 1)
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 12 of 1 52 table 8. spi master mode timi ng (spicpha = 0) parameters parameter description min typ max unit t sl sclk low pulse width 2 spir t core 1 (spir + 1) t core 1 ns t sh sclk high pulse width 2 spir t core 1 (spir + 1) t core 1 ns t dav data output valid after sclk edge 3 t core 1 ns t dosu data output setup before sclk edge 75 ns t dsu data input setup time before sclk edge 0 ns t dhd data input hold time after sclk edge t core 1 ns t df data output fall time 19 ns t dr data output rise time 19 ns t sr sclk rise time 19 ns t sf sclk fall time 19 ns 1 t core depends on the clock divider or cd[2:0] bits of the powcon sfr, address 0xc5 (see table 26); t core = 2 cd /4.096 mhz. sclk (spicpol = 0) t dsu sclk (spicpol = 1) mosi miso msb lsb lsb in bits [6:1] bits [6:1] t dhd t dr t dav t df t dosu t sh t sl t sr t sf msb in 0 6353-005 figure 6. spi master mode timing (spicpha = 0)
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 13 of 1 52 table 9. spi slave mode timing (spicpha = 1) parameters parameter description min typ max unit t ss ss to sclk edge 145 ns t sl sclk low pulse width 6 t core 1 ns t sh sclk high pulse width 6 t core 1 ns t dav data output valid after sclk edge 25 ns t dsu data input setup time before sclk edge 0 ns t dhd data input hold time after sclk edge 2 t core 1 + 0.5 s s t df data output fall time 19 ns t dr data output rise time 19 ns t sr sclk rise time 19 ns t sf sclk fall time 19 ns t sfs ss high after sclk edge 0 ns 1 t core depends on the clock divider or cd[2:0] bits of the powcon sfr, address 0xc5 (see table 26); t core = 2 cd /4.096 mhz. msb mosi bits [6:1] t dhd t dsu msb in lsb in bits [6:1] lsb t dr t df t dav miso t sl t sh t sr t sf t sfs t ss sclk (spicpol = 1) sclk (spicpol = 0) ss 06353-006 figure 7. spi slave mode timing (spicpha = 1)
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 14 of 1 52 table 10. spi slave mode timing (spicpha = 0) parameters parameter description min typ max unit t ss ss to sclk edge 145 ns t sl sclk low pulse width 6 t core 1 ns t sh sclk high pulse width 6 t core 1 ns t dav data output valid after sclk edge 25 ns t dsu data input setup time before sclk edge 0 ns t dhd data input hold time after sclk edge 2 t core 1 + 0.5 s s t df data output fall time 19 ns t dr data output rise time 19 ns t sr sclk rise time 19 ns t sf sclk fall time 19 ns t doss data output valid after ss edge 0 ns t sfs ss high after sclk edge 0 ns 1 t core depends on the clock divider or cd[2:0] bits of the powcon sfr, address 0xc5 (see table 26); t core = 2 cd /4.096 mhz. msb mosi bits [6:1] t dhd t dsu lsb in bits [6:1] lsb t dr t df t dav miso t sr t sf t sfs t ss sclk (spicpol = 1) sclk (spicpol = 0) ss t sh t sl t doss msb in 06353-007 figure 8. spi slave mode timing (spicpha = 0)
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 15 of 15 2 absolute maximum ratings t a = 25c, unless otherwise noted. table 11. parameter rating v dd to dgnd ?0.3 v to +3.7 v v bat to dgnd ?0.3 v to +3.7 v v dcin to dgnd ?0.3 v to v swout + 0.3 v input lcd voltage to agnd, lcdva, lcdvb, lcdvc 1 ?0.3 v to v swout + 0.3 v analog input voltage to agnd, v p , v n , i p , i pa , i pb , and i n ?2 v to +2 v digital input voltage to dgnd ?0.3 v to v swout + 0.3 v digital output voltage to dgnd ?0.3 v to v swout + 0.3 v operating temperature range (industrial) ?40c to +85c storage temperature range ?65c to +150c 64-lead lqfp, power dissipation lead temperature (soldering, 30 sec) 300c 1 when used with external resistor divider. stresses above those listed under absolute maximum ratings may cause permanent damage to the device. this is a stress rating only; functional operation of the device at these or any other conditions above those indicated in the operational section of this specification is not implied. exposure to absolute maximum rating conditions for extended periods may affect device reliability. thermal resistance ja is specified for the worst-case conditions, that is, a device soldered in a circuit board for surface-mount packages. table 12. thermal resistance package type ja jc unit 64-lead lqfp 60 20.5 c/w 64-lead lfcsp 27.1 2.3 c/w esd caution
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 16 of 1 52 com2/fp28 com1 com0 p1.4/t2/fp23 p1.3/t2ex/fp24 p1.2/fp25 com3/fp27 p1.5/fp22 p1.6/fp21 p1.7/fp20 p2.0/fp18 p2.1/fp17 p2.2/fp16 lcdvc lcdvp2 p0.1/fp19 lcdvb lcdva lcdvp1 fp15 fp14 fp13 fp12 fp11 fp10 fp9 fp8 fp7 fp6 fp5 fp4 fp3 ade7566/ade7569 v dcin dgnd v intd v swout v dd v inta v bat ref in/ou pin configurations and function descriptions t fp26 agnd i n i p v n v p reset ea xtal1 xtal2 p0.3/cf2 p0.2/cf1/rtccal p0.4/mosi/sdata p0.5/miso p0.6/sclk/t0 p1.0/rxd p1.1/txd fp0 fp1 fp2 int0 pin 1 indicator bctrl/int1/p0.0 sden/p2.3 p0.7/ss/t1 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 notes 1. it is recommended that the exposed pad on the bottom of the lfcsp be connected to the ground plane on the board. 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 top view (not to scale) 06353-120 figure 9. pin configuration for the ade7566/ade7569 table 13. pin function descriptions pin no. mnemonic description 1 com3/fp27 common output 3/lcd segment output 27. com3 is used for the lcd backplane. 2 com2/fp28 common output 2/lcd segment output 28. com2 is used for the lcd backplane. 3 com1 common output 1. com1 is used for the lcd backplane. 4 com0 common output 0. com0 is used for the lcd backplane. 5 p1.2/fp25 general-purpose digital i/o port 1.2/lcd segment output 25. 6 p1.3/t2ex/fp24 general-purpose digital i/o port 1.3/timer 2 control input/lcd segment output 24. 7 p1.4/t2/fp23 general-purpose digital i/o port 1.4/timer 2 input/lcd segment output 23. 8 p1.5/fp22 general-purpose digital i/o port 1.5/lcd segment output 22. 9 p1.6/fp21 general-purpose digital i/o port 1.6/lcd segment output 21. 10 p1.7/fp20 general-purpose digital i/o port 1.7/lcd segment output 20. 11 p0.1/fp19 general-purpose digital i/o port 0.1/lcd segment output 19. 12 p2.0/fp18 general-purpose digital i/o port 2.0/lcd segment output 18. 13 p2.1/fp17 general-purpose digital i/o port 2.1/lcd segment output 17. 14 p2.2/fp16 general-purpose digital i/o port 2.2/lcd segment output 16. 15 lcdvc this pin can be either an analog input when the lcd re sistor driver is enabled or an analog output when the lcd charge pump is enabled. when this pin is an analog output, it should be decoupled with a 470 nf capacitor. when this pin is an analog input, it is internally connected to v dd . a resistor should be connected between this pin and lcdvb to generate the two highest voltages for the lcd waveforms (see the lcd driver section). 16 lcdvp2 this pin can be either an analog input when the lcd re sistor driver is enabled or an analog output when the lcd charge pump is enabled. when this pin is an analog output, a 100 nf capacitor should be connected between this pin and lcdvp1. when this pin is an analog input, it is internally connected to lcdvp1 (see the lcd driver section). 17 lcdvb this pin can be either an analog input when the lcd re sistor driver is enabled or an analog output when the lcd charge pump is enabled. when this pin is an analog output, it should be decoupled with a 470 nf capacitor. when this pin is an analog input, a resist or should be connected between this pin and lcdvc to generate an intermediate voltage for the lcd driver. in 1/3 bias lcd mode, another resistor must be connected between this pin and lcdva to generate an other intermediate voltage. in 1/2 bias lcd mode, lcdvb and lcdva are internally connected (see the lcd driver section).
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 17 of 1 52 pin no. mnemonic description 18 lcdva this pin can be either an analog input when the lcd re sistor driver is enabled or an analog output when the lcd charge pump is enabled. when this pin is an analog output, it should be decoupled with a 470 nf capacitor. when this pin is an analog input, a resi stor should be connected between this pin and lcdvp1 to generate an intermediate voltage for the lcd driver. in 1/3 bias lcd mode, another resistor must be connected between this pin and lcdvb to generate another intermediate voltage. in 1/2 bias lcd mode, lcdva and lcdvb are internally connected (see the lcd driver section). 19 lcdvp1 this pin can be either an analog input when the lcd re sistor driver is enabled or an analog output when the lcd charge pump is enabled. when this pin is an analog output, a 100 nf capa citor should be connected between this pin and lcdvp2. when this pin is an analog input, a resistor should be connected between this pin and lcdva to generate an intermediate voltage fo r the lcd driver. another resistor must be connected between lcdvp1 and dgnd to generate another intermediate voltage (see the lcd driver section). 20 to 35 fp15 to fp0 lcd segment output 15 to lcd segment output 0. 36 p1.1/txd general-purpose digital i/o port 1.1/transmitter data output (asynchronous). 37 p1.0/rxd general-purpose digital i/o port 1.0/receiver data input (asynchronous). 38 p0.7/ ss /t1 general-purpose digital i/o port 0.7/slave select when spi is in slave mode/timer 1 input. 39 p0.6/sclk/t0 general-purpose digital i/o port 0.6/clock output for i 2 c or spi port/timer 0 input. 40 p0.5/miso general-purpose digital i/o port 0.5/data input for spi port. 41 p0.4/mosi/sdata general-purpose digital i/o port 0.4/data output for spi port/i 2 c-compatible data line. 42 p0.3/cf2 general-purpose digital i/o port 0.3/calibration frequency logic output 2. the cf2 logic output gives instantaneous active, reactive, i rms , or apparent power information. 43 p0.2/cf1/rtccal general-purpose digital i/o port 0.2/calibration frequency logic output 1/rtc calibration frequency logic output. the cf1 logic output gives instantaneous active, reactive, i rms , or apparent information. the rtccal logic output gives access to the calibrated rtc output. 44 sden /p2.3 serial download mode enable/general-purpose digita l i/o port 2.3. this pin is used to enable serial download mode through a resistor when pulled low on power-up or reset. on reset, this pin momentarily becomes an input, and the status of the pin is sampled. if there is no pull-down resistor in place, the pin momentarily goes high and then user code is executed. if the pin is pulled down on reset, the embedded serial download/debug kernel executes, and this pi n remains low during the internal program execution. after reset, this pin can be used as a digital output port pin (p2.3). 45 bctrl/ int1 /p0.0 digital input for battery control/external interrupt input 1/general-purpose digital i/o port 0.0. this logic input connects v dd or v bat to v swout internally when set to logic high or logic low, respectively. when left open, the connection between v dd or v bat and v swout is selected internally. 46 xtal2 a crystal can be connected across this pin and xtal1 to provide a clock source for the ade7566/ade7569. the xtal2 pin can drive one cmos load when an external clock is supplied at xtal1 or by the gate oscillator circuit. an internal 6 pf capaci tor is connected to this pin. 47 xtal1 an external clock can be provided at this logic input. alternatively, a tuning fork crystal can be connected across xtal1 and xtal2 to provide a clock source for the ade7566/ade7569. the clock frequency for specified operation is 32.768 khz. an internal 6 pf capacitor is connected to this pin. 48 int0 external interrupt input 0. 49, 50 v p , v n analog inputs for voltage channel. these inputs ar e fully differential voltage inputs with a maximum differential level of 400 mv for specified opera tion. this channel also has an internal pga. 51 ea this pin is used as an input for emulation. when held high, this input enables the device to fetch code from internal program memory locations. the ade7566/ade 7569 do not support external code memory. this pin should not be left floating. 52, 53 i p , i n analog inputs for current channel. these inputs are fully differential voltage inputs with a maximum differential level of 400 mv for specified operati on. this channel also has an internal pga. 54 agnd this pin provides the ground reference for the analog circuitry. 55 fp26 lcd segment output 26. 56 reset reset input, active low. 57 ref in/out this pin provides access to the on-chip voltage reference. the on-chip reference has a nominal value of 1.2 v 0.1% and a maximum temperature coefficient of 50 ppm/c. this pin should be decoupled with a 1 f capacitor in parallel with a ceramic 100 nf capacitor. 58 v bat power supply input from the battery with a 2.4 v to 3. 7 v range. this pin is connected internally to v dd when the battery is selected as the power supply for the ade7566/ade7569. 59 v inta this pin provides access to the on-chip 2.5 v analog ldo. no external active circuitry should be connected to this pin. this pin should be decoupled with a 10 f capacitor in parallel with a ceramic 100 nf capacitor.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 18 of 1 52 pin no. mnemonic description 60 v dd 3.3 v power supply input from the regulator. this pin is connected internally to v swout when the regulator is selected as the power supply for the ade7566/ade7569. this pin should be decoup led with a 10 f capacitor in parallel with a ceramic 100 nf capacitor. 61 v swout 3.3 v power supply output. this pin provides the supply voltage for the ldos and internal circuitry of the ade7566/ade7569. this pin should be decoupled with a 10 f capacitor in parallel with a ceramic 100 nf capacitor. 62 v intd this pin provides access to the on-chip 2.5 v digital ldo. no external active circuitry should be connected to this pin. this pin should be decoupled with a 10 f capacitor in parallel with a ceramic 100 nf capacitor. 63 dgnd ground reference for digital circuitry. 64 v dcin analog input for dc voltage monitoring. th e maximum input voltage on this pin is v swout with respect to agnd. this pin is used to monito r the preregulated dc voltage. ep exposed pad the exposed pad on the bottom of the lfcsp enhances thermal performance and is electrically connected to ground inside the package. it is recommended th at the exposed pad be connected to the ground plane on the board.
ade7169/ade7566/ade7569 ADE7116/ade7156/ade7166/ rev. b | page 19 of 1 52 lcdv lcd lcdv fp fp fp fp fp fp com2/fp28 com1 com0 p1.4/t2/fp23 p1.3/t2ex/fp24 p1.2/fp25 com3/fp27 p1.5/fp22 p1.6/fp21 p1.7/fp20 p2.0/fp18 p2.1/fp17 p2.2/fp16 lcdvc lcdvp2 p0.1/fp19 b va p1 15 14 13 12 11 10 fp9 fp8 fp7 fp6 fp5 fp4 fp3 ADE7116/ade7156/ ade7166/ade7169 v dcin dgnd v intd v swout v dd v inta v bat ref in/ou t i pb agnd i n i pa v n v p reset ea xtal1 xtal2 p0.3/cf2 p0.2/cf1/rtccal p0.4/mosi/sdata p0.5/miso p0.6/sclk/t0 p1.0/rxd p1.1/txd fp0 fp1 fp2 int0 bctrl/int1/p0.0 sden/p2.3 p0.7/ss/t1 pin 1 indicator 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 notes 1. it is recommended that the exposed pad on the bottom of the lfcsp be connected to the ground plane on the board. top view (not to scale) 06353-120 figure 10. pin configuration for the ADE7116/ade7156/ade7166/ade7169 table 14. pin function descriptions pin no. mnemonic description 1 com3/fp27 common output 3/lcd segment output 27. com3 is used for the lcd backplane. 2 com2/fp28 common output 2/lcd segment output 28. com2 is used for the lcd backplane. 3 com1 common output 1. com1 is used for the lcd backplane. 4 com0 common output 0. com0 is used for the lcd backplane. 5 p1.2/fp25 general-purpose digital i/o port 1.2/lcd segment output 25. 6 p1.3/t2ex/fp24 general-purpose digital i/o port 1.3/timer 2 control input/lcd segment output 24. 7 p1.4/t2/fp23 general-purpose digital i/o port 1.4/timer 2 input/lcd segment output 23. 8 p1.5/fp22 general-purpose digital i/o port 1.5/lcd segment output 22. 9 p1.6/fp21 general-purpose digital i/o port 1.6/lcd segment output 21. 10 p1.7/fp20 general-purpose digital i/o port 1.7/lcd segment output 20. 11 p0.1/fp19 general-purpose digital i/o port 0.1/lcd segment output 19. 12 p2.0/fp18 general-purpose digital i/o port 2.0/lcd segment output 18. 13 p2.1/fp17 general-purpose digital i/o port 2.1/lcd segment output 17. 14 p2.2/fp16 general-purpose digital i/o port 2.2/lcd segment output 16. 15 lcdvc in the ade7166/ade7169, this pin can be either an anal og input when the lcd resistor driver is enabled or an analog output when the lcd charge pump is enab led. in the ADE7116/ade7156, this pin is always an analog input. when this pin is an analog output, it should be decouple d with a 470 nf capacitor. when this pin is an analog input, it is internally connected to v dd . a resistor should be connected between this pin and lcdvb to generate the two highest voltages for the lcd waveforms (see the lcd driver section). 16 lcdvp2 in the ade7166/ade7169, this pin can be either an anal og input when the lcd resistor driver is enabled or an analog output when the lcd charge pump is enabled. in the ADE7116 and ade7156, this pin is always an analog input. when this pin is an analog output, a 100 nf capacitor should be connected between this pin and lcdvp1. when this pin is an analog input, it is internally connected to lcdvp1 (see the lcd driver section). 17 lcdvb in the ade7166/ade7169, this pin can be either an anal og input when the lcd resistor driver is enabled or an analog output when the lcd charge pump is enab led. in the ADE7116/ade7156, this pin is always an analog input. when this pin is an analog output, it should be decouple d with a 470 nf capacitor. when this pin is an analog input, a resistor should be connected between this pin and lcdvc to generate an intermediate voltage for the lcd driver. in 1/3 bias lcd mode, another resistor must be connected between this pin and lcdva to generate another intermediate voltage. in 1/2 bias lcd mode, lcdvb and lcdva are internally connected (see the lcd driver section).
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 20 of 152 pin no. mnemonic description 18 lcdva in the ade7166/ade7169, this pin can be either an anal og input when the lcd resistor driver is enabled or an analog output when the lcd charge pump is enab led. in the ADE7116/ade7156, this pin is always an analog input. when this pin is an analog output, it should be decouple d with a 470 nf capacitor. when this pin is an analog input, a resistor should be connected between this pin and lcdvp1 to generate an inter- mediate voltage for the lcd driver. in 1/3 bias lcd mode, another resistor must be connected between this pin and lcdvb to generate another intermediate voltage. in 1/2 bias lcd mode, lcdva and lcdvb are internally connected (see the lcd driver section). 19 lcdvp1 in the ade7166/ade7169, this pin can be either an anal og input when the lcd resistor driver is enabled or an analog output when the lcd charge pump is enab led. in the ADE7116/ade7156, this pin is always an analog input. when this pin is an analog output, a 100 nf capacitor should be connected between this pin and lcdvp2. when this pin is an analog input, a resistor should be connected between this pin and lcdva to generate an intermediate voltage for the lcd driver. another resistor must be connected between lcdvp1 and dgnd to generate another intermediate voltage (see the lcd driver section). 20 to 35 fp15 to fp0 lcd segment output 0 to lcd segment output 15. 36 p1.1/txd general-purpose digital i/o port 1.1/transmitter data output (asynchronous). 37 p1.0/rxd general-purpose digital i/o port 1.0/receiver data input (asynchronous). 38 p0.7/ ss /t1 general-purpose digital i/o port 0.7/slave select when spi is in slave mode/timer 1 input. 39 p0.6/sclk/t0 general-purpose digital i/o port 0.6/clock output for i 2 c or spi port/timer 0 input. 40 p0.5/miso general-purpose digital i/o port 0.5/data input for spi port. 41 p0.4/mosi/sdata general-purpose digital i/o port 0.4/data output for spi port/i 2 c-compatible data line. 42 p0.3/cf2 general-purpose digital i/o port 0.3/calibration frequency logic output 2. the cf2 logic output gives instantaneous active, reactive, i rms , or apparent power information. 43 p0.2/cf1/rtccal general-purpose digital i/o port 0.2/calibration frequency logic output 1/rtc calibration frequency logic output. the cf1 logic output gives instantaneous active, reactive, i rms , or apparent power information. the rtccal logic output gives access to the calibrated rtc output. 44 sden /p2.3 serial download mode enable/general-purpose digita l i/o port 2.3. this pin is used to enable serial download mode through a resistor when pulled low on power-up or reset. on reset, this pin momentarily becomes an input, and the status of the pin is sampled. if there is no pull-down resistor in place, the pin momentarily goes high and then user code is executed. if the pin is pulled down on reset, the embedded serial download/debug kernel executes, and this pi n remains low during the internal program execution. after reset, this pin can be used as a digital output port pin (p2.3). 45 bctrl/ int1 /p0.0 digital input for battery control/external interrupt input 1/general-purpose digital i/o port 0.0. this logic input connects v dd or v bat to v swout internally when set to logic high or logic low, respectively. when left open, the connection between v dd or v bat and v swout is selected internally. 46 xtal2 a crystal can be connected across this pin and xtal1 to provide a clock source for the ADE7116/ade7156/ ade7166/ade7169. the xtal2 pin can drive one cmos load when an external clock is supplied at xtal1 or by the gate oscillator circuit. an internal 6 pf capacitor is connected to this pin. 47 xtal1 an external clock can be provided at this logic input. alternatively, a tuning fork crystal can be connected across xtal1 and xtal2 to provide a clock source for the ADE7116/ade7156/ade7166/ade7169. the clock frequency for specified operation is 32.768 khz. an in ternal 6 pf capacitor is connected to this pin. 48 int0 external interrupt input 0. 49, 50 v p , v n analog inputs for voltage channel. these inputs ar e fully differential voltage inputs with a maximum differential level of 400 mv for specified opera tion. this channel also has an internal pga. 51 ea this pin is used as an input for emulation. when held high, this input enables the device to fetch code from internal program memory locations. the ADE7116/ ade7156/ade7166/ade7169 do not support external code memory. this pin should not be left floating. 52, 53 i pa , i n analog inputs for current channel. these inputs are fully differential voltage inputs with a maximum differential level of 400 mv for specified operati on. this channel also has an internal pga. 54 agnd this pin provides the ground reference for the analog circuitry. 55 i pb analog input for second current channel (i pb ). this input is fully differenti al with a maximum differential level of 400 mv, referred to i n for specified operation. this channel also has an internal pga. 56 reset reset input, active low. 57 ref in/out this pin provides access to the on-chip voltage reference. the on-chip reference has a nominal value of 1.2 v 0.1% and a maximum temperature coefficient of 50 ppm/c. this pin should be decoupled with a 1 f capacitor in parallel with a ceramic 100 nf capacitor. 58 v bat power supply input from the battery with a 2.4 v to 3. 7 v range. this pin is connected internally to v dd when the battery is selected as the power su pply for the ADE7116/ade7156/ade7166/ade7169.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 21 of 152 pin no. mnemonic description 59 v inta this pin provides access to the on-chip 2.5 v analog ldo. no external active circuitry should be connected to this pin. this pin should be decoupled with a 10 f capacitor in parallel with a ceramic 100 nf capacitor. 60 v dd 3.3 v power supply input from the regulator. this pin is connected internally to v swout when the regulator is selected as the power supply for the ADE7116/ade 7156/ade7166/ade7169. this pin should be decoupled with a 10 f capacitor in parallel with a ceramic 100 nf capacitor. 61 v swout 3.3 v power supply output. this pin provides the supply voltage for the ldos and internal circuitry of the ADE7116/ade7156/ade7166/ade7169. this pin should be de coupled with a 10 f capacitor in parallel with a ceramic 100 nf capacitor. 62 v intd this pin provides access to the on-chip 2.5 v digital ldo. no external active circuitry should be connected to this pin. this pin should be decoupled with a 10 f capacitor in parallel with a ceramic 100 nf capacitor. 63 dgnd ground reference for digital circuitry. 64 v dcin analog input for dc voltage monitoring. th e maximum input voltage on this pin is v swout with respect to agnd. this pin is used to monito r the preregulated dc voltage. ep exposed pad the exposed pad on the bottom of the lfcsp enhances thermal performance and is electrically connected to ground inside the package. it is recommended th at the exposed pad be connected to the ground plane on the board.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 22 of 152 typical performance characteristics ?2.0 ?1.5 ?1.0 ?0.5 0 0.5 1.0 1.5 2.0 ?40c; pf = 1 +25c; pf = 1 +85c; pf = 1 mid class c mid class c 0.1 1 10 100 0 6353-107 current channel (% of full scale) error (% of reading) gain = 1 integrator off internal reference ?2.0 ?1.5 ?1.0 ?0.5 0 0.5 1.0 1.5 2.0 0.1 1 10 100 0 6353-115 current channel (% of full scale) error (% of reading) gain = 1 integrator off internal reference +85c; pf = 0.866 +25c; pf = 0.866 ?40c; pf = 0.866 +85c; pf = 0 +25c; pf = 0 ?40c; pf = 0 figure 11. active energy error as a percentage of reading (gain = 1) over temperature with internal reference, integrator off figure 14. reactive energy error as a percentage of reading (gain = 1) over power factor with internal reference, integrator off ?2.0 ?1.5 ?1.0 ?0.5 0 0.5 1.0 1.5 2.0 ?40c; pf = 1 +25c; pf = 1 +85c; pf = 1 mid class c mid class c 0.1 1 10 100 0 6353-109 current channel (% of full scale) error (% of reading) gain = 1 integrator off internal reference gain = 1 integrator off internal reference ?1.5 ?1.0 ?0.5 0 0.5 1.0 1.5 0.1 1 10 100 06353-108 current channel (% of full scale) error (% of reading) mid class c mid class c +25c; pf = 1 +85c; pf = 1 ?40c; pf = 1 +25c; pf = 0.5 +85c; pf = 0.5 ?40c; pf = 0.5 figure 12. active energy error as a percentage of reading (gain = 1) over power factor with internal reference, integrator off figure 15. current rms error as a percentage of reading (gain = 1) over temperature with internal reference, integrator off ?2.0 ?1.5 ?1.0 ?0.5 0 0.5 1.0 1.5 2.0 ?40c; pf = 1 ?40c; pf = 0.5 +25c; pf = 1 +25c; pf = 0.5 +85c; pf = 0.5 +85c; pf = 1 mid class c mid class c 0.1 1 10 100 0 6353-110 current channel (% of full scale) error (% of reading) gain = 1 integrator off internal reference ?2.0 ?1.5 ?1.0 ?0.5 0 0.5 1.0 1.5 2.0 0.1 1 10 100 06353-114 current channel (% of full scale) error (% of reading) gain = 1 integrator off internal reference +85c; pf = 0 +25c; pf = 0 ?40c; pf = 0 figure 16. current rms error as a percentage of reading (gain = 1) over power factor with internal reference, integrator off figure 13. reactive energy error as a percentage of reading (gain = 1) over temperature with internal reference, integrator off
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 23 of 152 ?0.5 ?0.4 ?0.3 ?0.2 ?0.1 0 0.1 0.2 0.3 0.4 0.5 0.1 1 10 100 06353-111 current channel (% of full scale) error (% of reading) gain = 1 integrator off internal reference v rms ; 3.3v i rms ; 3.13v i rms ; 3.3v i rms ; 3.43v v rms ; 3.13v v rms ; 3.43v figure 17. voltage and current rms error as a percentage of reading (gain = 1) over power supply with internal reference, integrator off ?1.0 ?0.8 ?0.6 ?0.4 ?0.2 0 0.2 0.4 0.6 0.8 1.0 40 45 50 55 60 65 70 pf = 1 pf = 0.5 mid class b mid class b gain = 1 integrator off internal reference 06353-112 line frequency (hz) error (% of reading) figure 18. active energy error as a percentage of reading (gain = 1) over frequency with internal reference, integrator off ?0.5 ?0.4 ?0.3 ?0.2 ?0.1 0 0.1 0.2 0.3 0.4 0.5 0.1 1 10 100 06353-113 current channel (% of full scale) error (% of reading) gain = 1 integrator off internal reference var; 3.3v w; 3.43v w; 3.13v w; 3.3v var; 3.43v var; 3.13v figure 19. active and reactive energy error as a percentage of reading (gain = 1) over power supply with internal reference, integrator off ?1.5 ?1.0 ?0.5 0 0.5 1.0 1.5 0.1 1 10 100 pf = +0.5 pf = 1 pf = ?0.5 mid class c mid class c 06353-094 current channel (% of full scale) error (% of reading) gain = 8 integrator off internal reference figure 20. active energy error as a percentage of reading (gain = 8) over power factor with internal reference, integrator off ?0.8 ?0.6 ?0.4 ?0.2 0 0.2 0.4 0.6 0.8 pf = +0.5 pf = ?0.5 ?1.0 1.0 0.1 1 10 100 06353-095 current channel (% of full scale) error (% of reading) gain = 8 integrator off internal reference pf = 1 figure 21. reactive energy error as a percentage of reading (gain = 8) over power factor with internal reference, integrator off ?1.5 ?1.0 ?0.5 0 0.5 1.0 1.5 0.1 1 10 100 pf = +0.5 pf = 1 pf = ?0.5 mid class c mid class c 06353-096 current channel (% of full scale) error (% of reading) gain = 8 integrator off internal reference figure 22. current rms error as a percentage of reading (gain = 8) over power factor with internal reference, integrator off
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 24 of 152 ?0.8 ?1.0 ?0.6 ?0.4 ?0.2 0 0.2 0.4 0.6 0.8 1.0 0.1 1 10 100 0 6353-100 current channel (% of full scale) error (% of reading) gain = 16 integrator off internal reference ?40c; pf = 0 +85c; pf = 0 +85c; pf = 0.866 ?40c; pf = 0.866 +25c; pf = 0.866 +25c; pf = 0 ?2.0 ?1.5 ?1.0 ?0.5 0 0.5 1.0 1.5 2.0 ?40c; pf = 1 +25c; pf = 1 +85c; pf = 1 mid class c mid class c 0.1 1 10 100 0 6353-097 current channel (% of full scale) error (% of reading) gain = 16 integrator off internal reference figure 23. active energy error as a percentage of reading (gain = 16) over temperature with internal reference, integrator off figure 26. reactive energy error as a percentage of reading (gain = 16) over power factor with internal reference, integrator off ?40c; pf = 1 +85c; pf = 1 mid class c mid class c ?2.0 ?1.5 ?1.0 ?0.5 0 0.5 1.0 1.5 2.0 0.1 1 10 100 06353-101 current channel (% of full scale) error (% of reading) gain = 16 integrator off internal reference +25c; pf = 1 mid class c mid class c ?2.0 ?1.5 ?1.0 ?0.5 0 0.5 1.0 1.5 2.0 0.1 1 10 100 06353-098 current channel (% of full scale) error (% of reading) gain = 16 integrator off internal reference +85c; pf = 1 ?40c; pf = 1 ?40c; pf = 0.5 +85c; pf = 0.5 +25c; pf = 1 +25c; pf = 0.5 figure 24. active energy error as a percentage of reading (gain = 16) over power factor with internal reference, integrator off figure 27. current rms error as a percentage of reading (gain = 16) over temperature with internal reference, integrator off mid class c mid class c ?2.0 ?1.5 ?1.0 ?0.5 0 0.5 1.0 1.5 2.0 0.1 1 10 100 06353-102 current channel (% of full scale) error (% of reading) gain = 16 integrator off internal reference ?40c; pf = 1 +25c; pf = 1 ?40c; pf = 0.5 +85c; pf = 0.5 +25c; pf = 0.5 +85c; pf = 1 ?0.8 ?0.6 ?0.4 ?0.2 0 0.2 0.4 0.6 0.8 ?1.0 1.0 0.1 1 10 100 06353-099 current channel (% of full scale) error (% of reading) gain = 16 integrator off internal reference +85c; pf = 0 ?40c; pf = 0 +25c; pf = 0 figure 28. current rms error as a percentage of reading (gain = 16) over power factor with internal reference, integrator off figure 25. reactive energy error as a percentage of reading (gain = 16) over temperature with internal reference, integrator off
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 25 of 152 performance curves for th e ade7169 and ade7569 only mid class c mid class c ?2.0 ?1.5 ?1.0 ?0.5 0 0.5 1.0 1.5 2.0 0.1 1 10 100 06353-103 current channel (% of full scale) error (% of reading) gain = 16 integrator on internal reference ?40c; pf = 1 +85c; pf = 0.5 +25c; pf = 0.5 ?40c; pf = 0.5 +25c; pf = 1 +85c; pf = 1 figure 29. active energy error as a percentage of reading (gain = 16) over power factor with internal reference, integrator on ?0.8 ?0.6 ?0.4 ?0.2 0 0.2 0.4 0.6 0.8 ?1.0 1.0 0.1 1 10 100 0 6353-104 current channel (% of full scale) error (% of reading) gain = 16 integrator on internal reference +25c; pf = 0 +85c; pf = 0.866 ?40c; pf = 0 +25c; pf = 0.866 +85c; pf = 0 ?40c; pf = 0.866 figure 30. reactive energy error as a percentage of reading (gain = 16) over power factor with internal reference, integrator on ?40c; pf = 1 mid class c mid class c ?2.0 ?1.5 ?1.0 ?0.5 0 0.5 1.0 1.5 2.0 0.1 1 10 100 06353-105 current channel (% of full scale) error (% of reading) gain = 16 integrator on internal reference +25c; pf = 1 +25c; pf = 0.5 +85c; pf = 0.5 +85c; pf = 1 ?40c; pf = 0.5 figure 31. current rms error as a percentage of reading (gain = 16) over power factor with internal reference, integrator on
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 26 of 152 terminology measurement error the error associated with the energy measurement made by the ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 is defined by the following formula: percentage error = %100 ? ? ? ? ? ? ? ? ? energy true energy true register energy (1) phase error between channels the digital integrator and the high-pass filter (hpf) in the current channel have a nonideal phase response. to offset this phase response and equalize the phase response between channels, two phase correction networks are placed in the current channel: one for the digital integrator and the other for the hpf. the phase correction networks correct the phase response of the corresponding component and ensure a phase match between current channel and voltage channel to within 0.1 over a range of 45 hz to 65 hz with the digital integrator off. with the digital integrator on, the phase is corrected to within 0.4 over a range of 45 hz to 65 hz. power supply rejection (psr) psr quantifies the ADE7116/ade7156/ade7166/ade7169/ ade7566/ade7569 measurement error as a percentage of reading when the power supplies are varied. for the ac psr measurement, a reading at nominal supplies (3.3 v) is taken. a second reading is obtained with the same input signal levels when an ac (100 mv rms/120 hz) signal is introduced onto the supplies. any error introduced by this ac signal is expressed as a percentage of reading (see the measurement error definition). for the dc psr measurement, a reading at nominal supplies (3.3 v) is taken. a second reading is obtained with the same input signal levels when the supplies are varied 5%. any error introduced is again expressed as a percentage of the reading. adc offset error adc offset error is the dc offset associated with the analog inputs to the adcs. it means that, with the analog inputs connected to agnd, the adcs still see a dc analog input signal. the magnitude of the offset depends on the gain and input range selection (see the typical performance characteristics section). however, when hpf1 is switched on, the offset is removed from the current channel, and the power calculation is not affected by this offset. the offsets can be removed by performing an offset calibration (see the analog inputs section). gain error gain error is the difference between the measured adc output code (minus the offset) and the ideal output code (see the current channel adc section and voltage channel adc section). it is measured for each of the gain settings on the current channel (1, 2, 4, 8, and 16). the difference is expressed as a percentage of the ideal code.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 27 of 152 special function reg ister (sfr) mapping table 15. mnemonic address description intpr 0xff interrupt pins configuration (see table 17). scratch4 0xfe scratch pad 4 (see table 25). scratch3 0xfd scratch pad 3 (see table 24). scratch2 0xfc scratch pad 2 (see table 23). scratch1 0xfb scratch pad 1 (see table 22). batvth 0xfa battery detection threshold (see table 52). strbper 0xf9 peripheral adc strobe period (see table 49). ipsmf 0xf8 power management interrupt flag (see table 18). tempcal 0xf7 rtc temperature compensation (see table 135). rtccomp 0xf6 rtc nominal compensation (see table 134). batpr 0xf5 battery switchover configuration (see table 19). periph 0xf4 peripheral configuration (see table 20). diffprog 0xf3 temperature and supply delta (see table 50). b 0xf0 auxiliary math (see table 56). vdcinadc 0xef v dcin adc value (see table 53). lcdsege2 0xed lcd segment enable 2 (see table 98). ipsme 0xec power management interrupt enable (see table 21). spistat 0xea spi interrupt status (see table 150). spi2cstat 0xea i 2 c interrupt status (see table 154). spimod2 0xe9 spi configuration sfr 2 (see table 149). i2cadr 0xe9 i 2 c slave address (see table 153). spimod1 0xe8 spi configuration sfr 1 (see table 148). i2cmod 0xe8 i 2 c mode (see table 152). wav2h 0xe7 selection 2 sample msb (see table 31). wav2m 0xe6 selection 2 sample middle byte (see table 31). wav2l 0xe5 selection 2 sample lsb (see table 31). wav1h 0xe4 selection 1 sample msb (see table 31). wav1m 0xe3 selection 1 sample middle byte (see table 31). wav1l 0xe2 selection 1 sample lsb (see table 31). acc 0xe0 accumulator (see table 56). batadc 0xdf battery adc value (see table 54). mirqsth 0xde interrupt status 3 (see table 42). mirqstm 0xdd interrupt status 2 (see table 41). mirqstl 0xdc interrupt status 1 (see table 40). mirqenh 0xdb interrupt enable 3 (see table 45). mirqenm 0xda interrupt enable 2 (see table 44). mirqenl 0xd9 interrupt enable 1 (see table 43). adcgo 0xd8 start adc measurement (see table 51). mnemonic address description tempadc 0xd7 temperature adc value (see table 55). irmsh 0xd6 i rms measurement msb (see table 31). irmsm 0xd5 i rms measurement middle byte (see table 31). irmsl 0xd4 i rms measurement lsb (see table 31). vrmsh 0xd3 v rms measurement msb (see table 31). vrmsm 0xd2 v rms measurement middle byte (see table 31). vrmsl 0xd1 v rms measurement lsb (see table 31). psw 0xd0 program status word (see table 57). th2 0xcd timer 2 high byte (see table 120). tl2 0xcc timer 2 low byte (see table 121). rcap2h 0xcb timer 2 reload/capture high byte (see table 122). rcap2l 0xca timer 2 reload/capture low byte (see table 123). t2con 0xc8 timer/counter 2 control (see table 115). eadrh 0xc7 flash high byte address (see table 110). eadrl 0xc6 flash low byte address (see table 109). powcon 0xc5 power control (see table 26). kyreg 0xc1 key (see table 126). wdcon 0xc0 watchdog timer (see table 85). protr 0xbf flash read protection (see table 108). protb1 0xbe flash write/erase protection 1 (see table 107). protb0 0xbd flash write/erase protection 0 (see table 106). edata 0xbc flash data (see table 105). protky 0xbb flash protection key (see table 104). flshky 0xba flash key (see table 103). econ 0xb9 flash control (see table 102). ip 0xb8 interrupt priority (see table 79). pinmap2 0xb4 port 2 weak pull-up enable (see table 159). pinmap1 0xb3 port 1 weak pull-up enable (see table 158). pinmap0 0xb2 port 0 weak pull-up enable (see table 157). lcdcony 0xb1 lcd configuration y (see table 91). cfg 0xaf configuration (see table 63). lcddat 0xae lcd data (see table 97). lcdptr 0xac lcd pointer (see table 96). ieip2 0xa9 interrupt enable and priority 2 (see table 80). ie 0xa8 interrupt enable (see table 78). dpcon 0xa7 data pointer control (see table 76). intval 0xa6 rtc alarm interval (see table 133). hour 0xa5 rtc hours counter (see table 132). min 0xa4 rtc minutes counter (see table 131). sec 0xa3 rtc seconds counter (see table 130).
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 28 of 152 mnemonic address description hthsec 0xa2 rtc hundredths of a second counter (see table 129 ). timecon 0xa1 rtc configuration (see table 128 ). p2 0xa0 port 2 (see table 162 ). epcfg 0x9f extended port configuration (see table 156 ). sbaudt 0x9e enhanced serial baud rate control (see table 142 ). sbaudf 0x9d uart timer fractional divider (see table 143 ). lcdconx 0x9c lcd configuration x (see table 89 ). spi2crx 0x9b spi/i 2 c receive buffer (see table 147 ). spi2ctx 0x9a spi/i 2 c transmit buffer (see table 146 ). sbuf 0x99 serial port buffer (see table 141 ). scon 0x98 serial communications control (see table 140 ). lcdsege 0x97 lcd segment enable (see table 95 ). lcdclk 0x96 lcd clock (see table 92 ). lcdcon 0x95 lcd configuration (see table 88 ). mdath 0x94 energy measurement pointer data msb (see table 31 ). mnemonic address description mdatm 0x93 energy measurement pointer data middle byte (see table 31 ). mdatl 0x92 energy measurement pointer data lsb (see table 31 ). maddpt 0x91 energy measurement pointer address (see table 30 ). p1 0x90 port 1 (see table 161 ). th1 0x8d timer 1 high byte (see table 118 ). th0 0x8c timer 0 high byte (see table 116 ). tl1 0x8b timer 1 low byte (see table 119 ). tl0 0x8a timer 0 low byte (see table 117 ). tmod 0x89 timer/counter 0 and timer/counter 1 mode (see table 113 ). tcon 0x88 timer/counter 0 and timer/counter 1 control (see table 114 ). pcon 0x87 program control (see table 58 ). dph 0x83 data pointer high (see table 60 ). dpl 0x82 data pointer low (see table 59 ). sp 0x81 stack pointer (see table 62 ). p0 0x80 port 0 (see table 160 ).
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 29 of 152 power management the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 have elaborate power management circuitry that manages the switchover from regular power supply to battery and manages power supply failures. the power management functionalities can be accessed directly through the 8052 sfrs (see table 16 ). table 16. power management sfrs sfr address r/w mnemonic description 0xec r/w ipsme power management interrupt enable (see table 21 ). 0xf5 r/w batpr battery switchover configuration (see table 19 ). 0xf8 r/w ipsmf power management interrupt flag (see table 18 ). 0xff r/w intpr interrupt pins configuration (see table 17 ). 0xf4 r/w periph peripheral configuration (see table 20 ). 0xc5 r/w powcon power control (see table 26 ). 0xfb r/w scratch1 scratch pad 1 (see table 22 ). 0xfc r/w scratch2 scratch pad 2 (see table 23 ). 0xfd r/w scratch3 scratch pad 3 (see table 24 ). 0xfe r/w scratch4 scratch pad 4 (see table 25 ). power management register details table 17. interrupt pins configuration sfr (intpr, address 0xff) bit mnemonic default description 7 rtccal 0 controls rtc calibration output. when set, the rtc ca libration frequency selected by the fsel bits is output on the p0.2/cf1/rtccal pin. [6:5] fsel 00 sets rtc calibration outp ut frequency and calibration window. fsel result (calibration window, frequency) 00 30.5 sec, 1 hz 01 30.5 sec, 512 hz 10 0.244 sec, 500 hz 11 0.244 sec, 16 khz 4 reserved n/a [3:1] int1prg 000 controls the function of int1 . int1prg result x00 gpio enabled x01 bctrl enabled 01x int1 input disabled 11x int1 input enabled 0 int0prg 0 controls the function of int0 . int0prg result 0 int0 input disabled 1 int0 input enabled writing to the interrupt pins conf iguration sfr (intpr, address 0xff) to protect the rtc from runaway code, a key must be written to the key sfr (kyreg, address 0xc1) to obtain write access to intp r. kyreg (see table 126 ) should be set to 0xea to unlock this sfr and reset to 0 after a timekeeping register is written to. the rtc registers can be written using the following 8052 assembly code: mov kyreg, #0eah mov intpr, #080h
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 30 of 152 table 18. power management interrupt flag sfr (ipsmf, address 0xf8) bit bit address mnemonic default description 7 0xff fpsr 0 power supply restored interrupt flag. set when the v dd power supply has been restored. this occurs when the source of v swout changes from v bat to v dd . 6 0xfe fpsm 0 psm interrupt flag. set when an enabled psm interrupt condition occurs. 5 0xfd fsag 0 voltage sag interrupt flag. set when an ade energy measurement sag condition occurs. 4 0xfc reserved 0 this bit must be kept at 0 for proper operation. 3 0xfb fvadc 1 0 vdcinadc monitor interrupt flag. set when v dcin changes by vdcin_diff or when v dcin measurement is ready. 2 0xfa fbat 1 0 v bat monitor interrupt flag. set when v bat falls below batvth or when v bat measurement is ready. 1 0xf9 fbso 0 battery switchover interrupt flag. set when v swout switches from v dd to v bat. 0 0xf8 fvdcin 1 0 v dcin monitor interrupt flag. set when v dcin falls below 1.2 v. 1 this feature is not av ailable in the ADE7116. table 19. battery switchover configuration sfr (batpr, address 0xf5) bit mnemonic default description [7:2] reserved 00 these bits must be kept at 0 for proper operation. [1:0] batprg 00 control bits for battery switchover. batprg result 00 battery switchover enabled on low v dd 01 battery switchover enabled on low v dd and low v dcin 1x battery switchover disabled table 20. peripheral configuration sfr (periph, address 0xf4) bit mnemonic default description 7 rxflag 0 if set, indicates that an rx edge event triggered wake-up from psm2. 6 vswsource 1 indicates the power supply that is internally connected to v swout (0: v swout = v bat ; 1: v swout = v dd ). 5 vdd_ok 1 if set, indicates that v dd power supply is ready for operation. 4 pll_flt 0 if set, indicates that a pll fault occurred where the pll lost lock. set the pllack bit (see table 51 ) in the start adc measurement sfr (adcgo, address 0xd8) to acknowledge the fault and clear the pll_flt bit. 3 ref_bat_en 0 set this bit to enable inte rnal voltage reference in psm2 mode. this bit should be set if lcd is on in psm1 and psm2 mode. 2 reserved 0 this bit must be kept at 0 for proper operation. [1:0] rxprog 00 controls the function of the p1.0/rxd pin. rxprog result 00 gpio 01 rxd with wake-up disabled 11 rxd with wake-up enabled table 21. power management interrupt enable sfr (ipsme, address 0xec) bit mnemonic default description 7 epsr 0 enables a psm interrupt when the power supply restored interrupt flag (fpsr) is set. 6 reserved 0 reserved. 5 esag 0 enables a psm interrupt when the vo ltage sag interrupt flag (fsag) is set. 4 reserved 0 this bit must be kept at 0 for proper operation. 3 evadc 1 0 enables a psm interrupt when the vdcinadc monitor interrupt flag (fvadc) is set. 2 ebat 1 0 enables a psm interrupt when the v bat monitor interrupt flag (fbat) is set. 1 ebso 0 enables a psm interrupt when the batt ery switchover interrupt flag (fbso) is set. 0 evdcin 1 0 enables a psm interrupt when the v dcin monitor interrupt flag (fvdcin) is set. 1 this feature is not av ailable in the ADE7116.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 31 of 152 table 22. scratch pad 1 sfr (scratch1, address 0xfb) bit mnemonic default description [7:0] scratch1 0 value can be written/read in this register . this value is maintained in all the power saving modes. table 23. scratch pad 2 sfr (scratch2, address 0xfc) bit mnemonic default description [7:0] scratch2 0 value can be written/read in this register . this value is maintained in all the power saving modes. table 24. scratch pad 3 sfr (scratch3, address 0xfd) bit mnemonic default description [7:0] scratch3 0 value can be written/read in this register . this value is maintained in all the power saving modes. table 25. scratch pad 4 sfr (scratch4, address 0xfe) bit mnemonic default description [7:0] scratch4 0 value can be written/read in this register . this value is maintained in all the power saving modes. clearing the scratch pad registers (scratch1 , address 0xfb to scratch4, address 0xfe) note that these scratch pad registers are cleared only when the part loses v dd and v bat table 26. power control sfr (powcon, address 0xc5) bit mnemonic default description 7 reserved 1 reserved. 6 meter_off 0 set this bit to turn off the modulators and energy metering dsp circuitry to reduce power if metering functions are not needed in psm0 mode. 5 reserved 0 this bit should be kept at 0 for proper operation. 4 coreoff 0 set this bit to shut down the core and enter psm2 mode if in the psm1 operating mode. 3 reserved 0 reserved. [2:0] cd 010 controls the core clock frequency, f core . f core = 4.096 mhz/2 cd . cd result (f core in mhz) 000 4.096 001 2.048 010 1.024 011 0.512 100 0.256 101 0.128 110 0.064 111 0.032 writing to the power control sfr (powcon, address 0xc5) writing data to the powcon sfr involves writing 0xa7 into the key sfr (kreg, address 0xc1), which is described in table 126 , followed by a write to the powcon sfr for example, mov kyreg,#0a7h ;write kyreg to 0xa7 to get write access to the powcon sfr mov powcon,#10h ;shut down the core
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 32 of 152 power supply architecture each ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 has two power supply inputs, v dd and v bat , which require only a single 3.3 v power supply at v dd for full operation. a battery backup, or secondary power supply, with a maximum of 3.7 v can be connected to the v bat input. internally, the ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 connect v dd or v bat to v swout , which is used to derive power for the device circuitry. the v swout output pin reflects the voltage at the internal power supply (v swout ) and has a maximum output current of 6 ma. this pin can also be used to power a limited number of peripheral components. the 2.5 v analog supply (v inta ) and the 2.5 v supply for the core logic (v intd ) are derived by on- chip linear regulators from v swout . figure 32 shows the power supply architecture of the ADE7116/ade7156/ade7166/ ade7169/ade7566/ade7569. the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 provide automatic battery switchover between v dd and v bat based on the voltage level detected at v dd or v dcin . in addition, the bctrl input can be used to trigger a battery switchover. the conditions for switching v swout from v dd to v bat and back to v dd are described in the battery switchover section. v dcin is an input pin that can be connected to a 0 v to 3.3 v dc signal. this input is intended for power supply super- visory purposes and does not provide power to the ADE7116/ ade7156/ade7166/ade7169/ade7566/ade7569 circuitry. power supply management ldo v intd ldo v inta adc v sw adc scratch pad lcd rtc temperature adc 3.3v mcu ade spi/i 2 c uart 2.5v v dcin v dd v bat v swout bctrl * not available in the ADE7116. 06353-011 * * * figure 32. power supply architecture battery switchover the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 monitor v dd , v bat , and v dcin . automatic battery switch- over from v dd to v bat can be configured based on the status of the v dd , v dcin , or bctrl pin. battery switchover is enabled by default. setting bit 1 in the battery switchover configuration sfr (batpr, address 0xf5) disables battery switchover so that v dd is always connected to v swout (see tabl e 19 ). the source of v swout is indicated by bit 6 in the peripheral configuration sfr (periph, address 0xf4), which is described in table 20 . bit 6 is set when v swout is connected to v dd and cleared when v swout is connected to v bat . the battery switchover functionality provided by the ADE7116/ ade7156/ade7166/ade7169/ade7566/ade7569 allows a seamless transition from v dd to v bat . an automatic battery switchover option ensures a stable power supply to the device, as long as the external battery voltage is above 2.75 v. it allows continuous code execution even while the internal power supply is switching from v dd to v bat and back. note that the energy metering adcs are not available when v bat is being used for v swout . p ower supply monitor (psm) interrupts can be enabled to indicate when battery switchover occurs and when the v dd power supply is restored (see the power supply management (psm) interrupt section.) v dd to v bat the following three events switch the internal power supply (v swout ) from v dd to v bat : ? v dcin < 1.2 v. when v dcin falls below 1.2 v, v swout switches from v dd to v bat . this event is enabled when the batprg[1:0] bits in the battery switchover configuration sfr (batpr, address 0xf5) = 0b01. setting these bits disables switchover based on v dcin . battery switchover on low v dcin is disabled by default. ? v dd < 2.75 v. when v dd falls below 2.75 v, v swout switches from v dd to v bat . this event is enabled when the batprg[1:0] bits in the batpr sfr are cleared. ? falling edge on bctrl. when the battery control pin, bctrl, goes low, v swout switches from v dd to v bat . this external switchover signal can trigger a switchover to v bat at any time. setting the int1prg bits to x01 in the interrupt pins configuration sfr (intpr, address 0xff) enables the battery control pin (see table 17 ). s witching from v bat to v dd t o s w itch v swout from v bat to v dd , all of the following events must be true: ? v dd > 2.75 v. v swout switches back to v dd after v dd remains above 2.75 v. ? v dcin > 1.2 v and v dd > 2.75 v. if the low v dcin condition is enabled, v swout switches to v dd after v dcin remains above 1.2 v and v dd remains above 2.75 v. ? rising edge on bctrl. if the battery control pin is enabled, v swout switches back to v dd after bctrl is high, and the first or second bullet point is satisfied.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 33 of 152 power supply management (psm) interrupt the power supply monitor interrupt alerts the 8052 core of power supply events. the psm interrupt is disabled by default. setting the epsm bit in the interrupt enable and priority 2 sfr (ieip2, address 0xa9) enables the psm interrupt (see table 80 ). the power management interrupt enable sfr (ipsme, address 0xec) controls the events that result in a psm interrupt (see table 21 ). figure 33 illustrates how the psm interrupt vector is shared among the psm interrupt sources. the psm interrupt flags are latched and must be cleared by writing to the ipsmf power management interrupt flag sfr, address 0xf8 (see table 18 ). 06353-012 epsr fpsr esag fsag evadc fvadc ebat fbat ebso fbso evdcin fvdcin fpsm epsm true? pending psm interrupt epsr reserved esag reserved evadc* ebat* ebso evdcin* fpsr fpsm fsag reserved fvadc* fbat* fbso fvdcin* reserved pti reserved psi eade eti epsm esi ipsme addr. 0xec ipsmf addr. 0xf8 ieip2 addr. 0xa9 not involved in psm interrupt signal chain. * no t available in the ADE7116. figure 33. power supply management interrupt sources
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 34 of 152 battery switchover and power supply restored psm interrupt the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 can be configured to generate a psm interrupt when the source of v swout changes from v dd to v bat , indicating battery switchover. setting the ebso bit in the power manage- ment interrupt enable sfr (ipsme, address 0xec) enables this event to generate a psm interrupt (see table 21 ). the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 can also be configured to generate an interrupt when the source of v swout changes from v bat to v dd , indicating that the v dd power supply has been restored. setting the epsr bit in the power management interrupt enable sfr (ipsme, address 0xec) enables this event to generate a psm interrupt. the flags in the ipsmf sfr for these interrupts, fbso and fpsr, are set regardless of whether the respective enable bits have been set. the battery switchover and power supply restore event flags, fbso and fpsr, are latched. these events must be cleared by writing a 0 to these bits. bit 6 (vswsource) in the peripheral configuration sfr (periph, address 0xf4) tracks the source of v swout . the bit is set when v swout is connected to v dd and cleared when v swout is connected to v bat . v dcin adc psm interrupt the ade7156/ade7166/ade7169/ade7566/ade7569 can be configured to generate a psm interrupt when v dcin changes magnitude by more than a configurable threshold. this threshold is set in the temperature and supply delta sfr (diffprog, address 0xf3), which is described in table 50 . see the external voltage measurement section for more information. setting the evadc bit in the power management interrupt enable sfr (ipsme, address 0xec) enables this event to generate a psm interrupt. note that this feature is not available in the ADE7116. the v dcin voltage is measured using a dedicated adc. these measurements take place in the background at intervals to check the change in v dcin . conversions can also be initiated by writing to the start adc measurement sfr (adcgo, address 0xd8), as described in table 51 . the fvadc flag in the power manage- ment interrupt flag sfr (ipsmf, address 0xf8) indicates when a v dcin measurement is ready. see the external voltage measurement section for details on how v dcin is measured. v bat monitor psm interrupt the v bat voltage is measured using a dedicated adc. these measurements take place in the background at intervals to check the change in v bat . the fbat bit is set when the battery level is lower than the threshold set in the battery detection threshold sfr (batvth, address 0xfa), described in table 52 , or when a new measurement is ready in the battery adc value sfr (batadc, address 0xdf), described in table 54 . see the battery measurement section for more information. setting the ebat bit in the power management interrupt enable sfr (ipsme, address 0xec) enables this event to generate a psm interrupt. note that this feature is not available in the ADE7116. v dcin monitor psm interrupt the v dcin voltage is monitored by a comparator. the fvdcin bit in the power management interrupt flag sfr (ipsmf, address 0xf8) is set when the v dcin input level is lower than 1.2 v. setting the evdcin bit in the ipsme sfr enables this event to generate a psm interrupt. this event, which is associated with the sag monitoring, can be used to detect that a power supply (v dd ) is compromised and to trigger further actions prior to initiating a switch from v dd to v bat . note that this feature is not available in the ADE7116. sag monitor psm interrupt the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 energy measurement dsp monitors the ac voltage input at the v p and v n input pins. the saglvl register (address 0x14) is used to set the threshold for a line voltage sag event. the fsag bit in the power management interrupt flag sfr (ipsmf, address 0xf8) is set if the line voltage stays below the level set in the saglvl register for the number of line cycles set in the sagcyc register (address 0x13). see the line voltage sag detection section for more information. setting the esag bit in the power management interrupt enable sfr (ipsme, address 0xec) enables this event to generate a psm interrupt.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 35 of 152 using the power supply features in an energy meter application, the 3.3 v power supply (v dd ) is typically generated from the ac line voltage and regulated to 3.3 v by a voltage regulator ic. the preregulated dc voltage, typically 5 v to 12 v, can be connected to v dcin through a resistor divider. a 3.6 v battery can be connected to v bat . figure 34 shows how the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 power supply inputs are set up in this application. figure 35 shows the sequence of events that occurs if the main power supply generated by the psu starts to fail in the power meter application shown in figure 34 . the sag detection can provide the earliest warning of a potential problem on v dd . when a sag event occurs, user code can be configured to back up data and prepare for battery switchover if desired. the relative spacing of these interrupts depends on the design of the power supply. figure 36 shows the sequence of events that occurs if the main power supply starts to fail in the power meter application shown in figure 34 , with battery switchover on low v dcin or low v dd enabled. finally, the transition between v dd and v bat and the different power supply modes (see the operating modes section) are represented in figure 37 and figure 38 . voltage supervisory power supply management ipsmf sfr (addr. 0xf8) v sw v bat v swout v dd 58 61 60 voltage supervisory 64 v dcin 3.3v regulator 5v to 12v dc psu 50 sag detection 49 45 bctrl v p v n (240v, 220v, 110v typical) ac input 06353-013 figure 34. power supply management for energy meter application t 1 t 2 v dd v dcin v p ? v n 2.75v 1.2v sag level trip point sagcyc = 1 sag event (fsag = 1) v dcin event (fvdcin = 1) if switchover on low v dd is enabled, automatic battery switchover occurs. v swout is connected to v bat . bso event (fbso = 1) 0 6353-014 figure 35. power supply management interru pts and battery switchover with only v dd enabled for battery switchover
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 36 of 152 table 27. power supply event timing operating modes parameter time description t 1 10 ns min time between when v dcin goes below 1.2 v and when fvdcin is raised. t 2 10 ns min time between when v dd falls below 2.75 v and when battery switchover occurs. t 3 30 ms typ time between when v dcin falls below 1.2 v and when battery switchover occurs if v dcin is enabled to cause battery switchover. t 4 130 ms typ time between when power supply restore conditions are met (v dcin > 1.2 v and v dd > 2.75 v if batprg[1:0] = 0b01 or v dd > 2.75 v if batprg[1:0] = 0b00) and when v swout switches to v dd . 0 6353-015 t 1 t 3 v dd v dcin v p ? v n 2.75v 1.2v sag level trip point sagcyc = 1 sag event (fsag = 1) v dcin event (fvdcin = 1) if switchover on low v dcin is enabled, automatic battery switchover occurs. v swout is connected to v bat . bso event (fbso = 1) figure 36. power supply management inte rrupts and battery switchover with v dd or v dcin enabled for battery switchover v p ? v n sag level trip point sag event v dcin 1.2v 30ms min. 130ms min. v dcin event v dcin event v bat v dd 2.75v v sw battery switch enabled on low v dcin v sw battery switch enabled on low v dd psm0 psm0 psm0 psm0 psm1 or psm2 06353-016 psm1 or psm2 figure 37. power supply management transitions between modes
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 37 of 152 operating modes psm0 (normal mode) in psm0, or normal operating mode, v swout is connected to v dd . all of the analog circuitry and the digital circuitry powered by v intd and v inta are enabled by default. in normal mode, the default clock frequency, f core , which is established during a power-on reset or software reset, is 1.024 mhz. psm1 (battery mode) in psm1, or battery mode, v swout is connected to v bat . in this operating mode, the 8052 core and all of the digital circuitry are enabled by default. the analog circuitry for the ade energy metering dsp powered by v inta is disabled. this analog circuitry automatically restarts, and the switch to the v dd power supply occurs, when the v dd supply is >2.75 v and the pwrdn bit in the mode1 register (address 0x0b) is cleared (see table 33). the default f core for psm1, established during a power-on reset or software reset, is 1.024 mhz. psm2 (sleep mode) psm2 is a low power consumption sleep mode for use in battery operation. in this mode, v swout is connected to v bat . all of the 2.5 v digital and analog circuitry powered through v inta and v intd is disabled, including the mcu core, resulting in the following: ? the ram in the mcu is no longer valid. ? the program counter for the 8052, also held in volatile memory, becomes invalid when the 2.5 v supply is shut down. therefore, the program does not resume from where it left off but always starts from the power-on reset vector when the ADE7116/ade7156/ade7166/ade7169/ ade7566/ade7569 exit psm2. the 3.3 v peripherals (temperature adc 1 , v dcin adc 1 , rtc, and lcd) are active in psm2. they can be enabled or disabled to reduce power consumption and are configured for psm2 operation when the mcu core is active (see table 29 for more information about the peripherals and their psm2 configuration). the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 remain in psm2 until an event occurs to wake them up. in psm2 mode, the ADE7116/ade7156/ade7166/ade7169/ ade7566/ade7569 provide four scratch pad ram sfrs that are maintained during this mode. these sfrs can be used to save data from psm0 or psm1 mode when entering psm2 mode (see table 22 to table 25). in psm2, the ADE7116/ade7156/ade7166/ade7169/ ade7566/ade7569 maintain some sfrs (see table 28). the sfrs that are not listed in this table should be restored when the part enters psm0 or psm1 mode from psm2 mode. table 28. sfrs maintained in psm2 mode i/o configuration power supply management rtc peripherals lcd peripherals interrupt pins configuration sfr (intpr, address 0xff); see table 17 battery detection threshold sfr (batvth, address 0xfa); see table 52 rtc nominal compensation sfr (rtccomp, address 0xf6); see table 134 lcd segment enable 2 sfr (lcdsege2, address 0xed); see table 98 peripheral configuration sfr (periph, address 0xf4); see table 20 battery switchover configuration sfr (batpr, address 0xf5); see table 19 rtc temperature compensation sfr (tempcal, address 0xf7); see table 135 lcd configuration y sfr (lcdcony, address 0xb1); see table 91 port 0 weak pull-up enable sfr (pinmap0, address 0xb2); see table 157 battery adc value sfr (batadc, address 0xdf); see table 54 1 rtc configuration sfr (timecon, address 0xa1); see table 128 lcd configuration x sfr (lcdconx, address 0x9c); see table 89 port 1 weak pull-up enable sfr (pinmap1, address 0xb3); see table 158 peripheral adc strobe period sfr (strbper, address 0xf9); see table 49 1 hundredths of a second counter sfr (hthsec, 0xa2); see table 129 lcd configuration sfr (lcdcon, address 0x95); see table 88 port 2 weak pull-up enable sfr (pinmap2, address 0xb4); see table 159 temperature and supply delta sfr (diffprog, address 0xf3); see table 50 1 seconds counter sfr (sec, 0xa3); see table 130 lcd clock sfr (lcdclk, address 0x96); see table 92 scratch pad 1 sfr (scratch1, address 0xfb); see table 22 v dcin adc value sfr (vdcinadc, address 0xef); see table 53 1 minutes counter sfr (min, 0xa4); see table 131 lcd segment enable sfr (lcdsege, address 0x97); see table 95 scratch pad 2 sfr (scratch2, address 0xfc); see table 23 temperature adc value sfr (tempadc, address 0xd7); see table 55 1 hours counter sfr (hour, 0xa5); see table 132 lcd pointer sfr (lcdptr, address 0xac); see table 96 scratch pad 3 sfr (scratch3, address 0xfd); see table 24 alarm interval sfr (intval, 0xa6); see table 133 lcd data sfr (lcddat, address 0xae); see table 97 scratch pad 4 sfr (scratch4, address 0xfe); see table 25 1 this feature is not av ailable in the ADE7116.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 38 of 152 3.3 v peripherals an d wake-up events some of the 3.3 v peripherals are capable of waking the ADE7116/ ade7156/ade7166/ade7169/ade7566/ade7569 from psm2 mode. the events that can cause the devices to wake up from psm2 mode are listed in the wake-up event column in table 29 . the interrupt flag associated with these events must be cleared prior to executing instructions that put the ADE7116/ade7156/ ade7166/ade7169/ade7566/ade7569 in psm2 mode after wake-up. table 29. 3.3 v peripherals and wake-up events 3.3 v peripheral wake- up event wake-up enable bits flag interrupt vector comments temperature adc ?t maskable the temperature adc can wake up the ade7156/ade7166/ ade7169/ade7566/ade7569. a pending interrupt is generated according to the description in the temperature measurement section. this wake-up event can be disabled by disabling temperature measurements in the temperature and supply delta sfr (diffprog, address 0xf3) in psm2 mode. the temperature interrupt needs to be serviced and acknowledged prior to entering psm2 mode. v dcin adc v maskable fvadc ipsm the v dcin measurement can wake up the ade7156/ade7166/ ade7169/ade7566/ade7569. fvadc is set according to the description in the external voltage measurement section. this wake- up event can be disabled by clearing evadc in the power manage- ment interrupt enable sfr (ipsme, address 0xec); see table 21 . the fvadc flag needs to be cleared prior to entering psm2 mode. power supply management psr nonmaskable psr ipsm the ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 wake up if the power supply is restored (if v swout switches to be connected to v dd ). the vswsource flag, bit 6 of the peripheral configuration sfr (periph, address 0xf4), is set to indicate that v swout is connected to v dd . rtc midnight nonmaskable midnight irtc the ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 wake up at midnight every day to update their calendars. the rtc interrupt needs to be serviced an d acknowledged prior to entering psm2 mode. alarm maskable alarm irtc an alarm can be set to wake the ADE7116/ade7156/ade7166/ ade7169/ade7566/ade7569 after the desired amount of time. the rtc alarm is enabled by setting the alarm bit in the rtc configur- ation sfr (timecon, 0xa1). the rtc interrupt needs to be serviced and acknowledged prior to entering psm2 mode. i/o ports 1 int0 int0prg = 1 ie0 the edge of the interrupt is selected by the it0 bit in the tcon sfr (tcon, address 0x88). the ie0 flag bit in the tcon sfr is not affected. the interrupt 0 interrupt needs to be serviced and acknowledged prior to entering psm2 mode. int1 int1prg = 11x ie1 the edge of the interrupt is selected by the it1 bit in the tcon sfr (tcon, address 0x88). the ie1 flag bit in the tcon sfr is not affected. the interrupt 1 interrupt needs to be serviced and acknowledged prior to entering psm2 mode. rx edge rxprog[1:0] = 11 periph[7] (rxfg) an rx edge event occurs if a rising or falling edge is detected on the rx line. the uart rxd flag needs to be cleared prior to entering psm2 mode. external reset reset nonmaskable if the reset pin is brought low while the ase7116/ade7156/ ade7166/ade7169/ade7566/ade7569 are in psm2 mode, they wake up to psm1 mode. lcd the lcd can be enabled/disabled in psm2 mode. the lcd data memory remains intact. scratch pad the four scratchx registers remain intact in psm2 mode. 1 all i/o pins are treated as inputs. the weak pull-up on each i/o pin can be disabled individually in the port 0 weak pull-up e nable sfr (pinmap0, address 0xb2), port 1 weak pull-up enable sfr (pinmap1 , address 0xb3), and port 2 weak pull-up enable sfr (pinmap2, ad dress 0xb4) to decrease current consumption. the interrupts can be enabled or disabled.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 39 of 152 transitioning between operating modes the operating mode of the ADE7116/ade7156/ade7166/ ade7169/ade7566/ade7569 is determined by the power supply connected to v swout . therefore, changes in the power supply, such as when v swout switches from v dd to v bat or when v swout switches to v dd , alter the operating mode. this section describes events that change the operating mode. automatic battery switchover (psm0 to psm1) if any of the enabled battery switchover events occurs (see the battery switchover section), v swout switches to v bat . this switchover results in a transition from psm0 to psm1 operating mode. when battery switchover occurs, the analog circuitry used in the ade energy measurement dsp is disabled. to reduce power consumption, the user code can initiate a transition to psm2. entering sleep mode (psm1 to psm2) to reduce power consumption when vswout is connected to v bat , user code can initiate sleep mode, psm2, by setting bit 4 in the power control sfr (powcon, address 0xc5) to shut down the mcu core. events capable of waking the mcu can be enabled (see the 3.3 v peripherals and wake-up events section). servicing wake-up events (psm2 to psm1) the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 may need to wake up from psm2 mode to service wake-up events (see the 3.3 v peripherals and wake-up events ). psm1 code execution begins at the power-on reset vector. after servicing the wake-up event, the ADE7116/ade7156/ade 7166/ ade7169/ade7566/ade7569 can return to psm2 mode by setting bit 4 in the power control sfr (powcon, address 0xc5) to shut down the mcu core. automatic switch to v dd (psm2 to psm0) i f the conditions to switch v swout from v bat to v dd occur (see the battery switchover section), the operating mode switches to psm0. when this switch occurs, the analog circuitry used in the ade energy measurement dsp automatically restarts. note that code execution continues normally. a software reset can be perf- ormed to start psm0 code execution at the power-on reset vector. u sing the power management features because program flow is different for each operating mode, the status of v swout must be known at all times. the vswsource bit in the peripheral configuration sfr (periph, address 0xf4) indicates the power supply to which v swout is connected (see table 20 ). this bit can be used to control program flow on wake-up. because code execution always starts at the power-on reset vector, bit 6 of the periph sfr can be tested to determine which power supply is being used and to branch to normal code execution or to wake up event code execution. power supply events can also occur when the mcu core is active. to be aware of the events that change what v swout is connected to, use the following guidelines: ? enable the battery switchover interrupt (ebso) if v swout = v dd at power-up. ? enable the power supply restored interrupt (epsr) if v swout = v bat at power-up. an early warning that battery switchover is about to occur is provided by sag detection and, possibly, by low v dcin detection (see the battery switchover section). for a user-controlled battery switchover, enable automatic battery switchover on low v dd only. next, enable the low v dcin event to generate the psm interrupt. when a low v dcin event occurs, start data backup. upon completion of the data backup, enable battery switchover on low v dcin . battery switchover occurs 30 ms later. psm1 battery mode v swout connected to v bat psm0 normal mode v swout connected to v dd psm2 sleep mode v swout connected to v bat power supply restored automatic battery switchover wake-up event user code directs mcu to shut down core after servicing wake-up event power supply restored 06353-017 figure 38. transitioning between operating modes
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 40 of 152 energy measurement the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 offer a fixed function, energy measurement, digital processing core that provides all the information needed to measure energy in single-phase energy meters. the part provides two ways to access the energy measurements: direct access through sfrs for time sensitive information and indirect access through address and data sfrs for the majority of energy measurements. the i rms , v rms , interrupts, and waveform registers are readily available through the sfrs, as shown in table 31 . other energy measurement information is mapped to a page of memory that is accessed indirectly through the maddpt, mdatl, mdatm, and mdath sfrs. the address and data sfrs act as pointers to the energy measurement internal registers. access to energy measurement sfrs access to the energy measurement sfrs is achieved by reading or writing to the sfr addresses provided in table 31 . the internal data for the mirqx sfrs is latched byte by byte into the sfr when the sfr is read. the wav1x, wav2x, vrmsx, and irmsx registers are all 3-byte sfrs. the 24-bit data is latched into these sfrs when the high byte is read. reading the low or medium byte before the high byte results in reading the data from the previous latched sample. sample code to read the vrmsx register is as follows: mov r1, vrmsh //latches data in vrmsh, vrmsm, and vrmsl sfrs mov r2, vrmsm mov r3, vrmsl access to internal energy measurement registers access to the internal energy measurement registers is achieved by writing to the energy measurement pointer address sfr (maddpt, address 0x91). this sfr selects the energy measure- ment register to be accessed and determines whether a read or a write is performed (see table 30 ). table 30. energy measurement pointer address sfr (maddpt, address 0x91) bit description 7 1 = write, 0 = read [6:0] energy measurement internal register address writing to the internal energy measurement registers when bit 7 of the energy measurement pointer address sfr (maddpt, address 0x91) is set, the content of the mdatx sfrs (mdatl, mdatm, and mdath) is transferred to the internal energy measurement register designated by the address in the maddpt sfr. if the internal register is one byte long, only the mdatl sfr content is copied to the internal register, and the mdatm sfr and mdath sfr contents are ignored. the energy measurement core functions with an internal clock of 4.096 mhz/5 or 819.2 khz. because the 8052 core functions with another clock, 4.096 mhzM2 cd , synchronization between the two clock environments when cd = 0 or 1 is an issue. when data is written to the internal energy measurement registers, a small wait period needs to be implemented before another read or write to these registers can take place. sample code to write 0x0155 to the 2-byte saglvl register located at address 0x14 in the energy measurement memory space is as follows: mov mdatm,#01h mov mdatl,#55h mov maddpt,#saglvl_w (address 0x94) mov a,#05h djnz acc,$ ;next write or read to energy measurement sfr can be done after this. reading the internal energy measurement registers when bit 7 of the energy measurement pointer address sfr (maddpt, address 0x91) is cleared, the content of the internal energy measurement register designated by the address in maddpt is transferred to the mdatx sfrs. if the internal register is one byte long, only the mdatl sfr content is updated with a new value, and the mdatm sfr and mdath sfr contents are reset to 0x00. the energy measurement core functions with an internal clock of 4.096 mhz/5 or 819.2 khz. because the 8052 core functions with another clock, 4.096 mhzM2 cd , synchronization between the two clock environments when cd = 0 or 1 is an issue. when data is read from the internal energy measurement registers, a small wait period needs to be implemented before the mdatx sfrs are transferred to another sfr. sample code to read the peak voltage in the 2-byte vpklvl register located at 0x16 into the data pointer is as follows: mov maddpt,#vpklvl_r (address 0x16) mov a,#05h djnz acc,$ mov dph,mdatm mov dpl,mdatl
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 41 of 152 table 31. energy measurement sfrs address r/w mnemonic description 0x91 r/w maddpt energy measurement pointer address. 0x92 r/w mdatl energy measur ement pointer data lsb. 0x93 r/w mdatm energy measurement pointer data middle byte. 0x94 r/w mdath energy measurement pointer data msb. 0xd1 r vrmsl v rms measurement lsb. 0xd2 r vrmsm v rms measurement middle byte. 0xd3 r vrmsh v rms measurement msb. 0xd4 r irmsl i rms measurement lsb. 0xd5 r irmsm i rms measurement middle byte. 0xd6 r irmsh i rms measurement msb. 0xd9 r/w mirqenl energy measur ement interrupt enable lsb. 0xda r/w mirqenm energy measurem ent interrupt enable middle byte. 0xdb r/w mirqenh energy measur ement interrupt enable msb. 0xdc r/w mirqstl energy measur ement interrupt status lsb. 0xdd r/w mirqstm energy measuremen t interrupt status middle byte. 0xde r/w mirqsth energy measur ement interrupt status msb. 0xe2 r wav1l selection 1 sample lsb. 0xe3 r wav1m selection 1 sample middle byte. 0xe4 r wav1h selection 1 sample msb. 0xe5 r wav2l selection 2 sample lsb. 0xe6 r wav2m selection 2 sample middle byte. 0xe7 r wav2h selection 2 sample msb. adc dfc 2 multiplier integrator wattos[15:0] vagain[11:0] vadiv[7:0] irmsos[11:0] vrmsos[11:0] wgain[11:0] dt metering sfrs phcal[7:0] v n v p pga2 cf1 wdiv[7:0] % % 2 2 1, 2, 4, 8, 16 adc i p i n pga1 i {gain[2:0]} vardiv[7:0] % varos[15:0] vargain[11:0] dfc cf2num[15:0] cf2den[15:0] cf1den[15:0] cf1num[15:0] cf2 hpf hpf lpf lpf lpf2 lpf2 06353-092 figure 39. ade7566 and ade7569 energy metering block diagram
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 42 of 152 adc dfc 2 multiplier integrator wattos[15:0] vagain[11:0] vadiv[7:0] irmsos[11:0] vrmsos[11:0] wgain[11:0] dt phcal[7:0] metering sfrs v 2n pga2 v 2p cf1 wdiv[7:0] % % 2 2 1, 2, 4, 8, 16 adc i pa i n pga1 i {gain[2:0]} vardiv[7:0] % varos[15:0] vargain[11:0] dfc cf2num[15:0] cf2den[15:0] cf1den[15:0] cf1num[15:0] cf2 hpf hpf adc i pb pga1 hpf lpf lpf lpf2 lpf2 06353-118 ibgain[11:0] figure 40. ADE7116, ade7156, ade7166, and ade7169 energy metering block diagram
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 43 of 152 energy measurement registers table 32. energy measurement register list address maddpt[6:0] mnemonic r/w length (bits) signed/ unsigned default description 0x01 watthr r 24 s 0 reads wh accumulator without reset. 0x02 rwatthr r 24 s 0 reads wh accumulator with reset. 0x03 lwatthr r 24 s 0 reads wh accumulator synchronous to line cycle. 0x04 varhr 1 r 24 s 0 reads varh accumulator without reset. 0x05 rvarhr 1 r 24 s 0 reads varh accumulator with reset. 0x06 lvarhr 1 r 24 s 0 reads varh accumulator synchronous to line cycle. 0x07 vahr r 24 s 0 reads vah accumulator without reset. if the varmscfcon bit in the mode2 register (address 0x0c) is set, this register accumulates i rms . 0x08 rvahr r 24 s 0 reads vah accumulator with reset. if the varmscfcon bit in the mode2 register (address 0x0c) is set, this register accumulates i rms . 0x09 lvahr r 24 s 0 reads vah accumulator synchronous to line cycle. if the varmscfcon bit in the mode2 register (address 0x0c) is set, this register accumulates i rms . 0x0a per_freq r 16 u 0 reads line period or frequency register depending on mode2 register. 0x0b mode1 r/w 8 u 0x06 sets basic configuration of energy measurement (see table 33 ). 0x0c mode2 r/w 8 u 0x40 sets basic conf iguration of energy measurement (see table 34 ). 0x0d wavmode r/w 8 u 0 sets configuration of waveform sample 1 and waveform sample 2 (see table 35 ). 0x0e nlmode r/w 8 u 0 sets level of energy no load thresholds (see table 36 ). 0x0f accmode r/w 8 u 0 sets configuration of watt and var accumulation and various tamper alarms (see table 37 ). 0x10 phcal r/w 8 s 0x40 sets phase calibration register (see the phase compensation section). 0x11 zxtout r/w 12 0x0fff sets timeout for zero-crossin g timeout detection (see the zero- crossing timeout section). 0x12 lincyc r/w 16 u 0xffff sets number of half-line cycles for lwatthr, lvarhr, and lvahr accumulators. 0x13 sagcyc r/w 8 u 0xff sets number of half-line cycles for sag detection (see the line voltage sag detection section). 0x14 saglvl r/w 16 u 0 sets detection level for sag detection (see the line voltage sag detection section). 0x15 ipklvl r/w 16 u 0xffff sets peak detection level for current peak detection (see the peak detection section). 0x16 vpklvl r/w 16 u 0xffff sets peak detection level for voltage peak detection (see the peak detection section). 0x17 ipeak r 24 u 0 reads current peak level without reset (see the peak detection section). 0x18 rstipeak r 24 u 0 reads current peak level with reset (see the peak detection section). 0x19 vpeak r 24 u 0 reads voltage peak level without reset (see the peak detection section). 0x1a rstvpeak r 24 u 0 reads voltag e peak level with reset (see the peak detection section). 0x1b gain r/w 8 u 0 sets pga gain of analog inputs (see table 38 ). 0x1c ibgain 2 r/w 12 s 0 sets matching gain for i pb current input. 0x1d wgain r/w 12 s 0 se ts watt gain register. 0x1e vargain 1 r/w 12 s 0 sets var gain register. 0x1f vagain r/w 12 s 0 sets va gain register. 0x20 wattos r/w 16 s 0 sets watt offset register. 0x21 varos 1 r/w 16 s 0 sets var offset register. 0x22 irmsos r/w 12 s 0 sets current rms offset register. 0x23 vrmsos r/w 12 s 0 sets voltage rms offset register. 0x24 wdiv r/w 8 u 0 sets watt energy scaling register.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 44 of 152 address maddpt[6:0] mnemonic r/w length (bits) signed/ unsigned default description 0x25 vardiv r/w 8 u 0 sets va r energy scaling register. 0x26 vadiv r/w 8 u 0 sets va energy scaling register. 0x27 cf1num r/w 16 u 0 sets cf1 numerator register. 0x28 cf1den r/w 16 u 0x003f sets cf1 denominator register. 0x29 cf2num r/w 16 u 0 sets cf2 numerator register. 0x2a cf2den r/w 16 u 0x003f se ts cf2 denominator register. 0x3b reserved 0 this register must be set to its default value for proper operation. 0x3c reserved 0x0300 this register must be set to its default value for proper operation. 0x3d calmode 2 r/w 8 u 0 set calibration mode. 0x3e reserved 0 this register must be set to its default value for proper operation. 0x3f reserved 0 this register must be set to its default value for proper operation. 1 this function is not available in the ADE7116, ade7156, ade7166, or ade7566. 2 this function is not availab le in the ade7566 or ade7569. energy measurement internal register details table 33. mode1 register (mode1, address 0x0b) bit mnemonic default description 7 swrst 0 setting this bit resets all of the ener gy measurement registers to their default values. 6 diszxlpf 0 setting this bit disabl es the zero-crossing low-pass filter. 5 inte 0 setting this bit enables the digita l integrator for use with a di/dt sensor. 4 swapbits 0 setting this bit swaps ch1 adc and ch2 adc. 3 pwrdn 0 setting this bit powers down voltage and current adcs. 2 discf2 1 setting this bit di sables frequency output cf2. 1 discf1 1 setting this bit di sables frequency output cf1. 0 dishpf 0 setting this bit disables th e hpfs in voltage and current channels. table 34. mode2 register (mode2, address 0x0c) bit mnemonic default description [7:6] cf2sel 01 configuration bits for cf2 output. cf2sel result 00 cf2 frequency is proportional to active power. 01 cf2 frequency is proportional to reactive power. 1 1x cf2 frequency is proportional to apparent power or i rms . [5:4] cf1sel 00 configuration bits for cf1 output. cf1sel result 00 cf1 frequency is proportional to active power. 01 cf1 frequency is proportional to reactive power. 1 1x cf1 frequency is proportional to apparent power or i rms . 3 varmscfcon 0 configuration bits for apparent power or i rms for cf1, cf2 outputs and va accumulation registers (vahr, rvahr, and lvahr). note that cf1 cannot be proportional to va if cf2 is proportional to i rms , and vice versa. varmscfcon result 0 if cf1sel[1:0] = 1x, cf1 is proportional to va. if cf2sel[1:0] = 1x, cf2 is proportional to va. 1 if cf1sel[1:0] = 1x, cf1 is proportional to i rms . if cf2sel[1:0] = 1x, cf2 is proportional to i rms . 2 zxrms 0 logic 1 enables update of rm s values synchronou sly to voltage zx.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 45 of 152 bit mnemonic default description 1 freqsel 0 configuration bits to select period or frequency measurement for per_freq register (address 0x0a). freqsel result 0 per_freq register holds a period measurement. 1 per_freq register holds a frequency measurement. 0 waven 0 when this bit is set, waveform sampling mode is enabled. 1 this function is not available in the ADE7116, ade7156, ade7166, or ade7566. table 35. waveform mode register (wavmode, address 0x0d) bit mnemonic default description [7:5] wav2sel 000 waveform sample 2 selection for samples mode. wav2sel source 000 current 001 voltage 010 active power multiplier output 011 reactive power multiplier output 1 100 va multiplier output 101 i rms lpf output others reserved [4:2] wav1sel 000 waveform sample 1 selection for samples mode. wav1sel source 000 current 001 voltage 010 active power multiplier output 011 reactive power multiplier output 1 100 va multiplier output 101 i rms lpf output (low 24-bit) others reserved [1: 0] dtrt 00 waveform samples output data rate. dtrt update rate (clock = f core /5 = 819.2 khz) 00 25.6 ksps (clock/32) 01 12.8 ksps (clock/64) 10 6.4 ksps (clock/128) 11 3.2 ksps (clock/256) 1 this function is not available in the ADE7116, ade7156, ade7166, or ade7566. table 36. no load configuration register (nlmode, address 0x0e) bit mnemonic default description 7 disvarcmp 1 0 setting this bit disables fundamental var gain compensation over line frequency. 6 irmsnoload 0 logic 1 enables i rms no load threshold detection. the level is defined by the setting of the vanoload bits. [5:4] vanoload 00 apparent power no load threshold. vanoload result 00 no load detection disabled 01 no load detection enabled with threshold = 0.030% of full scale 10 no load detection enabled with threshold = 0.015% of full scale 11 no load detection enabled wi th threshold = 0.0075% of full scale
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 46 of 152 bit mnemonic default description [3:2] varnoload 1 00 reactive power no load threshold. varnoload result 00 no load detection disabled 01 no load detection enabled with threshold = 0.015% of full scale 10 no load detection enabled wi th threshold = 0.0075% of full scale 11 no load detection enabled wi th threshold = 0.0037% of full scale [1:0] apnoload 00 active power no load threshold. apnoload result 00 no load detection disabled 01 no load detection enabled with threshold = 0.015% of full scale 10 no load detection enabled wi th threshold = 0.0075% of full scale 11 no load detection enabled wi th threshold = 0.0037% of full scale 1 this function is not available in the ADE7116, ade7156, ade7166, or ade7566. table 37. accumulation mode register (accmode, address 0x0f) bit mnemonic default description 7 ichannel 1 0 this bit indicates the current channel used to measure energy in antitampering mode. 0 = channel a (i pa ) 1 = channel b (i pb ) 6 faultsign 1 0 configuration bit to select the even t that triggers a fault interrupt. 0 = fault interrupt occurs when part enters fault mode 1 = fault interrupt occurs when part enters normal mode 5 varsign 2 0 configuration bit to select the event that triggers a reactive power sign interrupt. if cleared to 0, a varsign interrupt occurs when reactive power changes from positive to negative. if set to 1, a varsign interrupt occurs when reactive power changes from negative to positive. 4 apsign 0 configuration bit to select event that triggers an active power sign interrupt. if cleared to 0, an apsign interrupt occurs when active power changes from positive to negative. if set to 1, an apsign interrupt occurs when active power changes from negative to positive. 3 absvarm 2 0 logic 1 enables absolute value accumulation of reactive power in energy register and pulse output. 2 savarm 2 0 logic 1 enables reactive power accumulation depending on the sign of the active power. if active power is positive, var is accumulated as it is . if active power is negative, the sign of the var is reversed for the accumulation. this accumula tion mode affects both the var registers (varhr, rvarhr, lvarhr) and the pulse output when connected to var. 2 1 poam 0 logic 1 enables positive-only accumulation of active power in energy register and pulse output. 0 absam 0 logic 1 enables absolute value accumulation of active power in energy register and pulse output. 1 this function is not availab le in the ade7566 or ade7569. 2 this function is not available in the ADE7116, ade7156, ade7166, or ade7566. table 38. gain register (gain, address 0x1b) bit mnemonic default description [7:5] pga2 000 these bits define the voltage channel input gain. pga2 result 000 gain = 1 001 gain = 2 010 gain = 4 011 gain = 8 100 gain = 16 4 reserved 0 reserved.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 47 of 152 bit mnemonic default description 3 cfsign_opt 0 this bit defines where the cf change of sign detection (apsign or varsign) is implemented. cfsign_opt result 0 1 filtered power signal on a per-cf basis [2:0] pga1 000 these bits define the current channel input gain. pga1 result 000 gain = 1 1 001 gain = 2 010 gain = 4 011 gain = 8 100 gain = 16 1 this gain is not recommended in the ade7166 or ade7169 because it can create an overranging of the adc when both current input s are in opposite phase. table 39. calibration mode register (calmode, address 0x3d) 1 bit mnemonic default description [7:6] reserved 0 these bits must be kept at 0 for proper operation. [5:4] sel_i_ch 0 these bits define the curr ent channel used for energy measurements. sel_i_ch result 00 current channel automatically sele cted by the tampering condition 01 current channel connected to i pa 10 current channel connected to i pb 11 current channel automatically sele cted by the tampering condition 3 v_ch_short 0 logic 1 shorts the voltage channel to ground. 2 i_ch_short 0 logic 1 shorts the current channel to ground. [1:0] reserved these bits must be kept at 0 for proper operation. 1 this register is not availab le in the ade7566 or ade7569. interrupt status/enable sfrs table 40. interrupt status 1 sfr (mirqstl, address 0xdc) bit interrupt flag description 7 adeirqflag this bit is set if any of the ade status flags that are en abled to generate an ade inte rrupt is set. this bit is automatically cleared when all of the enabled ade status flags are cleared. 6 reserved reserved. 5 faultsign 1 logic 1 indicates that the fault mode has changed acco rding to the configuration of the accmode register. 4 varsign 2 logic 1 indicates that the reactive power sign has ch anged according to the configuration of the accmode register. 3 apsign logic 1 indicates that the active power sign has changed according to the configuration of the accmode register. 2 vanoload logic 1 indicates that an interrupt has been caused by apparent power no load detection. this interrupt is also used to reflect that the part is entering the i rms no load mode. 1 rnoload 2 logic 1 indicates that an interrupt has been ca used by reactive power no load detection. 0 apnoload logic 1 indicates that an interrupt has b een caused by active power no load detection. 1 this function is not availab le in the ade7566 or ade7569. 2 this function is not available in the ADE7116, ade7156, ade7166, or ade7566.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 48 of 152 table 41. interrupt status 2 sfr (mirqstm, address 0xdd) bit interrupt flag description 7 cf2 logic 1 indicates that a pulse on cf2 has been issued. the flag is set even if the cf2 pulse output is not enabled by clearing bit 2 of the mode1 register. 6 cf1 logic 1 indicates that a pulse on cf1 has been issued. the flag is set even if the cf1 pulse output is not enabled by clearing bit 1 of the mode1 register. 5 vaeof logic 1 indicates that the vahr register has overflowed. 4 reof 1 logic 1 indicates that the varhr register has overflowed. 3 aeof logic 1 indicates that the watthr register has overflowed. 2 vaehf logic 1 indicates that the vahr register is half full. 1 rehf 1 logic 1 indicates that the varhr register is half full. 0 aehf logic 1 indicates that the watthr register is half full. 1 this function is not available in the ADE7116, ade7156, ade7166, or ade7566. table 42. interrupt status 3 sfr (mirqsth, address 0xde) bit interrupt flag description 7 reset indicates the end of a reset (for both software and hardware reset). 6 reserved reserved. 5 wfsm logic 1 indicates that new data is present in the waveform registers (address 0xe2 to address 0xe7). 4 pki logic 1 indicates that the current channel has exceeded the ipklvl value. 3 pkv logic 1 indicates that the voltage channel has exceeded the vpklvl value. 2 cycend logic 1 indicates the end of the energy accumu lation over an integer number of half-line cycles. 1 zxto logic 1 indicates that no zero crossing on the line voltage happened for the last zxtout half-line cycles. 0 zx logic 1 indicates detection of a zero crossing in the voltage channel. table 43. interrupt enable 1 sfr (mirqenl, address 0xd9) bit interrupt enable bit description [7:6] reserved reserved. 5 faultsign 1 when this bit is set to logic 1, the faultsign bit set creates a pending ade interrupt to the 8052 core. 4 varsign 2 when this bit is set to logic 1, the varsign flag set creates a pending ade interrupt to the 8052 core. 3 apsign when this bit is set to logic 1, the apsign fl ag set creates a pending ade interrupt to the 8052 core. 2 vanoload when this bit is set to logic 1, the vanoload flag set creates a pending ade interrupt to the 8052 core. 1 rnoload 2 when this bit is set to logic 1, the rnoload flag set creates a pending ade interrupt to the 8052 core. 0 apnoload when this bit is set to logic 1, the apnoload flag set creates a pending ade interrupt to the 8052 core. 1 this function is not availab le in the ade7566 or ade7569. 2 this function is not available in the ADE7116, ade7156, ade7166, or ade7566. table 44. interrupt enable 2 sfr (mirqenm, address 0xda) bit interrupt enable bit description 7 cf2 when this bit is set to logic 1, a cf2 pulse creates a pending ade interrupt to the 8052 core. 6 cf1 when this bit is set to logic 1, a cf1 pulse creates a pending ade interrupt to the 8052 core. 5 vaeof when this bit is set to logic 1, the vaeof fl ag set creates a pending ade interrupt to the 8052 core. 4 reof 1 when this bit is set to logic 1, the reof flag set creates a pending ade interrupt to the 8052 core. 3 aeof when this bit is set to logic 1, the aeof flag set creates a pending ade interrupt to the 8052 core. 2 vaehf when this bit is set to logic 1, the vaehf flag set creates a pending ade interrupt to the 8052 core. 1 rehf 1 when this bit is set to logic 1, the rehf flag set creates a pending ade interrupt to the 8052 core. 0 aehf when this bit is set to logic 1, the aehf flag set creates a pending ade interrupt to the 8052 core. 1 this function is not available in the ADE7116, ade7156, ade7166, or ade7566.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 49 of 152 table 45. interrupt enable 3 sfr (mirqenh, address 0xdb) bit interrupt enable bit description [7:6] reserved reserved. 5 wfsm when this bit is set to logic 1, the wfsm fl ag set creates a pending ade interrupt to the 8052 core. 4 pki when this bit is set to logic 1, the pki flag set creates a pending ade interrupt to the 8052 core. 3 pkv when this bit is set to logic 1, the pkv flag set creates a pending ade interrupt to the 8052 core. 2 cycend when this bit is set to logic 1, the cycend flag set creates a pending ade interrupt to the 8052 core. 1 zxto when this bit is set to logic 1, the zxto fl ag set creates a pending ade interrupt to the 8052 core. 0 zx when this bit is set to logic 1, the zx flag set creates a pending ade interrupt to the 8052 core. analog inputs each ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 has two fully differential voltage input channels. the maximum differential input voltage for the v p /v n and i p /i n input pairs is 0.4 v. for the ADE7116/ade7156/ade7166/ade7169, pga1 = 1 is not recommended because, at full scale, when both i pa and i pb are 180 out of phase, the adc can be overranged. it is recom- mended, for these products, that pga1 = 2, 4, 8, or 16 be used. each analog input channel has a programmable gain amplifier (pga) with possible gain selections of 1, 2, 4, 8, and 16. the gain selections are made by writing to the gain register (see table 38 and figure 41 ). bit 2 to bit 0 select the gain for the pga in the current channel, and bit 7 to bit 5 select the gain for the pga in the voltage channel. figure 42 shows how a gain selec- tion for the current channel is made using the gain register. 00000000 76543210 gain register* current and voltage channels pga control pga2 gain select 000 = 1 001 = 2 010 = 4 011 = 8 100 = 16 pga1 gain select 000 = 1 001 = 2 010 = 4 011 = 8 100 = 16 reserved *register contents show power-on defaults. addr: 0x1b 06353-019 cfsign_opt figure 41. analog gain register k v in i p i n 00000000 76543210 gain[7:0] gain (k) selection v in 06353-018 figure 42. pga in current channel
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 50 of 152 analog-to-digital conversion each ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 has two - analog-to-digital converters (adcs). the outputs of these adcs are mapped directly to waveform sampling sfrs (address 0xe2 to address 0xe7) and are used for energy measurement internal digital signal processing. in psm1 (battery mode) and psm2 (sleep mode), the adcs are powered down to minimize power consumption. for simplicity, the block diagram in figure 44 shows a first- order - adc. the converter is made up of the - modulator and the digital low-pass filter (lpf). a - modulator converts the input signal into a continuous serial stream of 1s and 0s at a rate determined by the sampling clock. in the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569, the sampling clock is equal to 4.096 mhz/5. the 1-bit dac in the feedback loop is driven by the serial data stream. the dac output is subtracted from the input signal. if the loop gain is high enough, the average value of the dac output (and, therefore, the bit stream) can approach that of the input signal level. for any given input value in a single sampling interval, the data from the 1-bit adc is virtually meaningless. only when a large number of samples are averaged is a meaningful result obtained. this averaging is carried into the second part of the adc, the digital lpf. by averaging a large number of bits from the modulator, the low-pass filter can produce 24-bit data-words that are proportional to the input signal level. the - converter uses two techniques to achieve high resolution from what is essentially a 1-bit conversion technique. the first is oversampling. oversampling means that the signal is sampled at a rate (frequency) that is many times higher than the bandwidth of interest. for example, the sampling rate in the ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 is 4.096 mhz/5 (819.2 khz), and the band of interest is 40 hz to 2 khz. oversampling has the effect of spreading the quantization noise (noise due to sampling) over a wider bandwidth. with the noise spread more thinly over a wider bandwidth, the quantiza- tion noise in the band of interest is lowered (see figure 43 ). however, oversampling alone is not efficient enough to improve the signal-to-noise ratio (snr) in the band of interest. for example, an oversampling ratio of four is required to increase the snr by only 6 db (1 bit). to keep the oversampling ratio at a reasonable level, it is possible to shape the quantization noise so that the majority of the noise lies at the higher frequencies. in the - modulator, the noise is shaped by the integrator, which has a high-pass-type response for the quantization noise. the result is that most of the noise is at the higher frequencies where it can be removed by the digital lpf. this noise shaping is shown in figure 43 . 409.6 0 819.2 2 noise s ign a l digita l filter a ntialias filte r (rc) sampling frequency high resolution output from digital lpf shaped noise 409.6 0 819.2 2 noise s ign a l frequenc y (khz) frequency (khz) 06353-021 figure 43. noise reduction due to oversampling and noise shaping in the analog modulator + ? integrator v ref 1-bit dac digital low-pass filter 24 mclk/5 c r analog low-pass filter ... 10100101 ... latched comparator 06353-020 figure 44. first-order -? adc
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 51 of 1 52 antialiasing filter figure 44 also shows an analog lpf (rc) on the input to the modulator. this filter is present to prevent aliasing, an artifact of all sampled systems. aliasing means that frequency com- ponents in the input signal to the adc that are higher than half the sampling rate of the adc appear in the sampled signal at a frequency below half the sampling rate. figure 45 illustrates the effect. frequency components (the black arrows) above half the sampling frequency (also known as the nyquist frequency, that is, 409.6 khz) are imaged or folded back down below 409.6 khz. this happens with all adcs, regardless of the architecture. in the example shown, only frequencies near the sampling frequency (819.2 khz) move into the band of interest for metering (40 hz to 2 khz). this allows the use of a very simple lpf (low-pass filter) to attenuate high frequency (at approximately 819.2 khz) noise and prevents distortion in the band of interest. for conventional current sensors, a simple rc filter (single-pole lpf) with a corner frequency of 10 khz produces an attenuation of approximately 40 db at 819.2 khz (see figure 45 ). the 20 db per decade attenuation is usually sufficient to eliminate the effects of aliasing for conventional current sensors. however, for a di/dt sensor such as a rogowski coil, the sensor has a 20 db per decade gain. this neutralizes the ?20 db per decade attenuation produced by one simple lpf. therefore, when using a di/dt sensor, care should be taken to offset the 20 db per decade gain. one simple approach is to cascade two rc filters to produce the ?40 db per decade attenuation needed. 409.6 0 819.2 2 frequency (khz) sampling frequency a liasing effects image fre quencies 06353-022 figure 45. adc and signal processing in current channel outline dimensions adc transfer function both adcs in the ADE7116/ade7156/ade7166/ade7169/ ade7566/ade7569 are designed to produce the same output code for the same input signal level. with a full-scale signal on the input of 0.4 v and an internal reference of 1.2 v, the adc output code is nominally 2,147,483 or 0x20c49b. the maximum code from the adc is 4,194,304; this is equivalent to an input signal level of 0.794 v. however, for specified performance, it is recommended that the full-scale input signal level of 0.4 v not be exceeded. current channel adc figure 46 and figure 47 show the adc and signal processing chain for the current channel. in waveform sampling mode, the adc outputs a signed, twos complement, 24-bit data-word at a maximum of 25.6 ksps (4.096 mhz/160). with the specified full-scale analog input signal of 0.4 v and pga1 = 1, the adc produces an output code that is approximately between 0x20c49b (+2,147,483d) and 0xdf3b65 (?2,147,483d). for inputs of 0.25 v, 0.125 v, 62.5 mv, and 31.3 mv with pga1 = 2, 4, 8, and 16, respectively, the adc produces an output code that is approximately between 0x28f5c2 (+2,684,354d) and 0xd70a3e (?2,684,354d).
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 52 of 152 pga1 adc i p i n i reference 1, 2, 4 8, 16 {gain[2:0]} hpf digital integrator* dt mode1[5] current rms (i rms ) calculation waveform sample register active and reactive power calculation 0v v1 analog input range 0.25v, 0.125v, 62.5mv, 31.3mv current channel waveform data range 0x28f5c2 0x000000 0xd70a3e current channel waveform data range after integrator (50hz) 0x342cd0 0x000000 0xcbd330 current channel waveform data range after integrator (60hz) 0x2b7850 0x000000 0xd487b0 60hz 50hz * when digital integrator is enabled, full-scale output data is atte nuated dep e nding on the signal frequency because the integrator has a ?20db/decade frequency response. when disabled, the output is not further attenuated. not available in the ade7566. 06353-023 figure 46. adc and signal processing in current channel wi th pga1 = 1, 2, 4, 8, or 16 for the ade7566 and ade7569 pga1 adc i pa i pb i n i reference ibgain 1, 2, 4 8, 16 {gain[2:0]} hpf digital integrator* dt mode1[5] current rms (i rms ) calculation waveform sample register active and reactive power calculation 0v v1 analog input range 0.25v, 0.125v, 62.5mv, 31.3mv current channel waveform data range 0x28f5c2 0x000000 0xd70a3e current channel waveform data range after integrator (50hz) 0x342cd0 0x000000 0xcbd330 current channel waveform data range after integrator (60hz) 0x2b7850 0x000000 0xd487b0 60hz 50hz *when digital integrator is enabled, full-scale output data is attenuated depending on the signal frequency because the integrator has a ?20db/decade frequency response. when disabled, the output is not further attenuated. not available in the ADE7116, ade7156, or ade7166. 06353-117 pga1 adc hpf figure 47. adc and signal processing in current channel with pga1 = 2, 4, 8, or 16 for the ADE7116, ade7156, ade7166, and ade71 69
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 53 of 152 voltage channel adc figure 48 shows the adc and signal processing chain for the voltage channel. in waveform sampling mode, the adc outputs a signed, twos complement, 24-bit data-word at a maximum of 25.6 ksps (mclk/160). the adc produces an output code that is approximately between 0x28f5 (+10,485d) and 0xd70b (?10,485d). channel sampling the waveform samples of the current adc and voltage adc can also be routed to the waveform registers to be read by the mcu core. the active, reactive, and apparent power and energy calculation remain uninterrupted during waveform sampling. when in waveform sampling mode, one of four output sample rates can be chosen by using the dtrt[1:0] bits of the wav m o d e r e g i s t e r ( s e e tabl e 35 ). the output sample rate can be 25.6 ksps, 12.8 ksps, 6.4 ksps, or 3.2 ksps. if the wfsm enable bit is set in the interrupt enable 3 sfr (mirqenh, address 0xdb), the 8052 core has a pending ade interrupt. the sampled signals selected in the wavmode register are latched into the waveform sfrs when the waveform high byte (wav1h or wav2h) is read. the ade interrupt stays active until the wfsm status bit is cleared (see the energy measurement interrupts section). analog input range hpf adc reference v2 0v 0.5v, 0.25v, 0.125v, 62.5mv, 31.3mv voltage rms (v rms ) calculation v p v n pga2 v2 voltage channel waveform data range 0xd70b 0x0000 0x28f5 a cti v e a nd re a cti v e power calculation lpf1 f ?3db = 63.7hz mode 1[6] zx signal data range for 60hz signal 0xe230 0x0000 0x1dd0 zx detection zx signal data range for 50hz signal 0xdfc9 0x0000 0x2037 voltage peak detect 1, 2, 4, 8, 16 {gain[7:5]} waveform sample register 06353-024 figure 48. adc and signal processing in voltage channel
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 54 of 152 fault detection the ADE7116/ade7156/ade7166/ade7169 incorporate a fault detection scheme that warns of fault conditions and allows the part to continue accurate measurement during a fault event. (this function is not available in the ade7566/ ade7569.) the ADE7116/ade7156/ade7166/ade7169 do this by continu- ously monitoring both current inputs (i pa and i pb ). for ease of understanding, these currents are referred to as phase and neutral (return) currents. a fault condition is defined when the difference between i pa and i pb is greater than 6.25% of the active channel. if a fault condition is detected and the inactive channel is larger than the active channel, the ADE7116/ade7156/ ade7166/ade7169 automatically switch current measurement to the inactive channel. during a fault, the active, reactive, and apparent power and the i rms are generated using the larger of the two currents. on power-up, i pa is the current input selected for active, reactive, and apparent power and i rms calculations. to prevent a false alarm, averaging is done for the fault detection, and a fault condition is detected approximately 1 second after the event. fault detection is automatically disabled when the voltage signal is less than 0.3% of the full- scale input range. this eliminates false detection of a fault due to noise at light loads. because the ADE7116/ade7156/ade7166/ade7169 look for a difference between the voltage signals on i pa and i pb , it is important that both current transducers be closely matched. channel selection indication the current channel selected for measurement is indicated by bit 7 (ichannel) in the accmode register (address 0x0f). when this bit is cleared, i pa is selected and, when it is set, i pb is selected. the ade7166/ade7169 automatically switch from one channel to the other and report the channel configuration in the accmode register (address 0x0f). the current channel selected for measurement can also be forced. setting the sel_i_ch[1:0] bits in the calmode register (address 0x3d) selects i pa and i pb , respectively. when both bits are cleared or set, the current channel used for measurement is selected automatically based on the fault detection. fault indication the ADE7116/ade7156/ade7166/ade7169 provide an indication of the part going in or out of a fault condition. the new fault condition is indicated by the faultsign flag (bit 5) in the interrupt status 1 sfr (mirqstl, address 0xdc). when the faultsign bit (bit 6) of the accmode register (address 0x0f) is cleared, the faultsign flag in the interrupt status 1 sfr (mirqstl, address 0xdc) is set when the part is entering a fault condition or a normal condition. when the faultsign bit (bit 5) is set in the interrupt enable 1 sfr (mirqenl, address 0xd9), and the faultsign flag (bit 5) in the interrupt status 1 sfr (mirqstl, address 0xdc) is set, the 8052 core has a pending ade interrupt. fault with active input greater than inactive input if i pa is the active current input (that is, being used for billing), and the voltage signal on i pb (the inactive input) falls below 93.75% of i pa , and the faultsign bit (bit 6) of the accmode register (address 0x0f) is cleared, the faultsign flag (bit 5) in the interrupt status 1 sfr (mirqstl, address 0xdc) is set. both analog inputs are filtered and averaged to prevent false triggering of this logic output. as a consequence of the filtering, there is a time delay of approximately 3 seconds on the logic output after the fault event. the faultsign flag is indepen- dent of any activity. because i pa is the active input and it is still greater than i pb , billing is maintained on i pa ; that is, no swap to the i pb input occurs. i pa remains the active input.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 55 of 1 52 fault with inactive input greater than active input if the difference between i pb , the inactive input, and i pa , the active input (that is, being used for billing), becomes greater than 6.25% of i pb , and the faultsign bit (bit 6) of the accmode register (address 0x0f) is cleared, the faultsign flag (bit 5) in the interrupt status 1 sfr (mirqstl, address 0xdc) is set. the i pb analog input becomes the active input. again, a time constant of about 3 seconds is associated with this swap. i pa does not become the active channel again until i pa is greater than i pb and the difference between i pa and i pb in this orderbecomes greater than 6.25% of i pb . however, if the faultsign bit (bit 6) of the accmode register (address 0x0f) is set, the faultsign flag (bit 5) in the interrupt status 1 sfr (mirqstl, address 0xdc) is set as soon as i pa is within 6.25% of i pb . this threshold eliminates potential chatter between i pa and i pb . calibration concerns typically, when a meter is calibrated, the voltage and current circuits are separated, as shown in figure 49 . current passes through only the phase circuit or the neutral circuit. figure 49 shows current being passed through the phase circuit. this is the preferred option because the ADE7116/ade7156/ ade7166/ade7169 start billing on the i pa input on power-up. the phase circuit ct is connected to i pa in the diagram. because the current sensors are not perfectly matched, it is important to match current inputs. the ADE7116/ ade7156/ade7166/ade7169 provide a gain calibration register for i pb , ibgain (address 0x1c). ibgain is a 12-bit, signed, twos complement register that provides a gain resolution of 0.0244%/lsb. for calibration, a first measurement should be done on i pa by setting the sel_i_ch bits to 0b01 in the calmode register (address 0x3d). this measurement should be compared to the measurement on i pb . measuring i pb can be forced by setting the sel_i_ch bits to 0b10 in the calmode register (address 0x3d). the gain error between these two measurements can be evaluated using the following equation: () () () () a a b it measuremen it measuremen it measuremen error ? = % (2) the two channels, i pa and i pb , can then be matched by writing ?error(%)/(1 + error (%)) 2 12 to the ibgain register (address 0x1c). this matching adjustment is valid for all energy measurements made by the ADE7116/ade7156/ ade7166/ade7169, including active power, reactive power (ade7169 only), apparent power, and i rms . agnd i pb i n i pa r f r f c f c f ct ct r b r b 0v v a 0 i pb phase neutral r f r a v p r f v n c t c f v test current 240v rms 06353-025 figure 49. fault conditions for inactive input greater than active input di/dt current sensor and digital integrator for the ade7169/ade7569 a di/dt sensor, a feature available for the ad7169/ade7569 but not for the ADE7116/ade7156/ade7166/ade7169, detects changes in the magnetic field caused by ac currents. figure 50 shows the principle of a di/dt current sensor. magnetic field created by current (directly proportional to current) + emf (electromotive force) induced by changes in magnetic flux density (di/dt) 06353-026 figure 50. principle of a di/dt current sensor the flux density of a magnetic field induced by a current is directly proportional to the magnitude of the current. the changes in the magnetic flux density passing through a conductor loop generate an electromotive force (emf) between the two ends of the loop. the emf is a voltage signal that is proportional to the di/dt of the current. the voltage output from the di/dt current sensor is determined by the mutual inductance between the current-carrying conductor and the di/dt sensor. the current signal needs to be recovered from the di/dt signal before it can be used. an integrator is, therefore, necessary to restore the signal to its original form.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 56 of 152 frequency (hz) ? 1.0 ?6.0 40 70 45 gain (db) 50 55 60 65 ?1.5 ?2.0 ?2.5 ?3.5 ?4.5 ?5.5 ?3.0 ?4.0 ?5.0 06353-029 the ade7169/ade7569 have a built-in digital integrator to recover the current signal from the di/dt sensor. the digital integrator on the current channel is switched off by default when the ade7169/ade7569 are powered up. setting the inte bit (bit 5) in the mode1 register (address 0x0b) turns on the integrator. figure 51 to figure 54 show the gain and phase response of the digital integrator. frequency (hz) 10 gain (db) 0 ?10 ?20 ?30 ?40 ?50 100 1000 0 6353-027 figure 53. combined gain response of the digital integrator and phase compensator (40 hz to 70 hz) ?89.75 ?89.80 ?89.85 ?89.90 ?89.95 ?90.00 frequency (hz) phase (degrees) 40 45 70 50 55 60 65 ?90.05 ? 89.70 06353-030 figure 51. combined gain response of the digital integrator and phase compensator frequency (hz) 10 2 10 3 06353-106 freq ? 88.0 phase (degrees) ?88.5 ?89.0 ?89.5 ?90.0 ?90.5 figure 54. combined phase response of the digital integrator and phase compensator (40 hz to 70 hz) note that the integrator has a ?20 db/dec attenuation and an approximately ?90 phase shift. when combined with a di/dt sensor, the resulting magnitude and phase response should be a flat gain over the frequency band of interest. the di/dt sensor has a 20 db/dec gain associated with it. it also generates significant high frequency noise. therefore, a more effective antialiasing filter is needed to avoid noise due to aliasing (see the antialiasing filter section). figure 52. combined phase response of the digital integrator and phase compensator when the digital integrator is switched off, the ade7169/ade7569 can be used directly with a conventional current sensor, such as a current transformer (ct), or with a low resistance current shunt.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 57 of 1 52 power quality measurements zero-crossing detection each ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 has a zero-crossing detection circuit on the voltage channel. this zero crossing is used to produce a zero-crossing internal signal (zx) and is used in calibration mode. the zero crossing is generated by default from the output of lpf1. this filter has a low cutoff frequency and is intended for 50 hz and 60 hz systems. if needed, this filter can be disabled to allow a higher frequency signal to be detected or to limit the group delay of the detection. if the voltage input fundamental frequency is below 60 hz, and a time delay in zx detection is acceptable, it is recommended that lpf1 be enabled. enabling lpf1 limits the variability in the zx detection by eliminating the high frequency components. figure 55 shows how the zero- crossing signal is generated. 1, 2, 4, 8, 16 adc 2 reference lpf1 f ?3db = 63.7hz pga2 {gain [7:5]} v p v n zero crossing zx hpf mode 1[6] 43.24 @ 60hz 1.0 0.73 zx v2 lpf1 06353-031 figure 55. zero-crossing detection on the voltage channel the zero-crossing signal, zx, is generated from the output of lpf1 (bypassed or not). lpf1 has a single pole at 63.7 hz (at mclk = 4.096 mhz). as a result, there is a phase lag between the analog input signal v2 and the output of lpf1. the phase lag response of lpf1 results in a time delay of approximately 2 ms (@ 60 hz) between the zero crossing on the analog inputs of the voltage channel and zx detection. the zero-crossing detection also drives the zx flag in the interrupt status 3 sfr (mirqsth, address 0xde). if the zx bit in the interrupt enable 3 sfr (mirqenh, address 0xdb) is set, the 8052 core has a pending ade interrupt. the ade interrupt stays active until the zx status bit is cleared (see the energy measurement interrupts section). zero-crossing timeout the zero-crossing detection also has an associated timeout register, zxtout (address 0x11). this unsigned, 12-bit register is decremented (1 lsb) every 160/mclk seconds. the register is reset to its user programmed, full-scale value every time a zero crossing is detected on the voltage channel. the default power-on value in this register is 0xfff. if the internal register decrements to 0 before a zero crossing is detected in the interrupt status 3 sfr (mirqsth, address 0xde), and the zxto bit (bit 1) in the interrupt enable 3 sfr (mirqenh, address 0xdb) is set, the 8052 core has a pending ade interrupt. the ade interrupt stays active until the zxto status bit is cleared (see the energy measurement interrupts section). the zxtout register (address 0x11) can be written to or read by the user (see the energy measurement register list section). the resolution of the register is 160/mclk seconds per lsb. thus, the maximum delay for an interrupt is 0.16 seconds (1/mclk 2 12 ) when mclk = 4.096 mhz. figure 56 shows the mechanism of the zero-crossing timeout detection when the line voltage stays at a fixed dc level for more than mclk/160 zxtout seconds. 12-bit internal register value zxtout zxto flag bit voltage channel 06353-032 figure 56. zero-crossing timeout detection period or frequency measurements the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 provide the period or frequency measurement of the line. the period or frequency measurement is selected by clearing or setting the freqsel bit (bit 1) in the mode2 register (address 0x0c). the period/frequency register, per_freq (address 0x0a), is an unsigned 16-bit register that is updated every period. if lpf1 is enabled, a settling time of 1.8 sec is associated with this filter before the measurement is stable. when the period measurement is selected, the measurement has a 2.44 s/lsb (4.096 mhz/10) resolution, which represents 0.014% when the line frequency is 60 hz. when the line frequency is 60 hz, the value of the period register is approximately 0d6827. the length of the register enables the measurement of line frequencies as low as 12.5 hz. the period register is stable at 1 lsb when the line is established, and the measurement does not change. when the frequency measurement is selected, the measurement has a 0.0625 hz/lsb resolution when mclk = 4.096 mhz, which represents 0.104% when the line frequency is 60 hz. when the line frequency is 60 hz, the value of the frequency register is 0d960. the frequency register is stable at 4 lsb when the line is established, and the measurement does not change.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 58 of 152 line voltage sag detection in addition to detection of the loss of the line voltage signal (zero crossing), the ADE7116/ade7156/ade7166/ade7169/ ade7566/ade7569 can also be programmed to detect when the absolute value of the line voltage drops below a certain peak value for a number of line cycles. this condition is illustrated in figure 57 . sag reset low when voltage channel exceeds saglvl [15:0] and sag flag reset full scale s aglvl [15:0] sag fl a g sagcyc [7:0] = 0x04 3 line cycles 06353-033 voltage channel figure 57. sag detection figure 57 shows the line voltage falling below a threshold that is set in the sag level register (saglvl[15:0], address 0x14) for three line cycles. the quantities 0 and 1 are not valid for the sagcyc register, and the contents represent one more than the desired number of full line cycles. for example, when the sag cycle (sagcyc[7:0], address 0x13) contains 0x04, fsag (bit 5) in the power management interrupt flag sfr (ipsmf, address 0xf8) is set at the end of the third line cycle after the line voltage falls below the threshold. if the sag enable bit (esag, bit 5) in the power management interrupt enable sfr (ipsme, address 0xec) is set, the 8052 core has a pending power supply management interrupt. the psm interrupt stays active until the esag bit is cleared (see the power supply management (psm) interrupt section). in figure 57 , the sag flag (fsag) is set on the fifth line cycle after the signal on the voltage channel first dropped below the threshold level. sag level set the 2-byte contents of the sag level register (saglvl, address 0x14) are compared to the absolute value of the output from lpf1. therefore, when lpf1 is enabled, writing 0x2038 to the sag level register puts the sag detection level at full scale (see figure 57 ). writing 0x00 or 0x01 puts the sag detection level at 0. the sag level register is compared to the input of the zx detection, and detection is made when the zx input falls below the contents of the sag level register. peak detection the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 can also be programmed to detect when the absolute value of the voltage or current channel exceeds a specified peak value. figure 58 illustrates the behavior of the peak detection for the voltage channel. both voltage and current channels are monitored at the same time. pkv reset low when mirqsth sfr is read vpklvl[15:0] v 2 reset bit pkv in mirqsth sf r pkv interrupt flag 06353-034 figure 58. peak level detection figure 58 shows a line voltage exceeding a threshold that is set in the voltage peak register (vpklvl, address 0x16). the voltage peak event is recorded by setting the pkv flag in the interrupt status 3 sfr (mirqsth, address 0xde). if the pkv enable bit (bit 3) is set in the interrupt enable 3 sfr (mirqenh, address 0xdb), the 8052 core has a pending ade interrupt. similarly, the current peak event is recorded by setting the pki flag (bit 4) in the interrupt status 3 sfr (mirqsth, address 0xde). the ade interrupt stays active until the pkv or pki status bit is cleared (see the energy measurement interrupts section). peak level set the contents of the vpklvl (address 0x16) and ipklvl (address 0x15) registers are compared to the absolute value of the voltage and 2 msbs of the current channel, respectively. thus, for example, the nominal maximum code from the current channel adc with a full-scale signal is 0x28f5c2 (see the current channel adc section). therefore, writing 0x28f5 to the ipklvl register puts the current channel peak detection level at full scale and sets the current peak detection to its least sensitive value. writing 0x00 puts the current channel detection level at 0. the detection is done by comparing the contents of the ipklvl register to the incoming current channel sample. the pki flag indicates that the peak level is exceeded. if the pki or pkv bit is set in the interrupt enable 3 sfr (mirqenh, address 0xdb), the 8052 core has a pending ade interrupt. peak level record each ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 records the maximum absolute value reached by the current and voltage channels in two different registers, ipeak (address 0x17) and vpeak (address 0x19), respectively. each register is a 24-bit unsigned register that is updated each time the absolute value of the waveform sample from the corresponding channel is above the value stored in the ipeak or vpeak register. the contents of the vpeak register correspond to the maximum absolute value observed on the voltage channel input. the contents of ipeak and vpeak represent the maximum absolute value observed on the current and voltage input, respectively. reading the rstipeak (address 0x18) and rstvpeak (address 0x1a) registers clears their respective contents after the read operation.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 59 of 152 phase compensation the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 must work with transducers that can have inherent phase errors. for example, a phase error of 0.1 to 0.3 is not uncommon for a current transformer (ct). these phase errors can vary from part to part, and they must be corrected to perform accurate power calculations. the errors associated with phase mismatch are particularly noticeable at low power factors. the ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 provide a means of digitally calibrating these small phase errors. the part allows a small time delay or time advance to be intro- duced into the signal processing chain to compensate for small phase errors. because the compensation is in time, this technique should be used only for small phase errors in the range of 0.1 to 0.5. correcting large phase errors using a time shift technique can introduce significant phase errors at higher harmonics. the phase calibration register (phcal[7:0], address 0x10) is a twos complement, signed, single-byte register that has values ranging from 0x82 (?126d) to 0x68 (+104d). the phcal register is centered at 0x40, meaning that writing 0x40 to the register gives 0 delay. by changing this register, the time delay in the voltage channel signal path can change from ?231.93 s to +48.83 s (mclk = 4.096 mhz). one lsb is equivalent to a 1.22 s (4.096 mhz/5) time delay or advance. a line frequency of 60 hz gives a phase resolution of 0.026 at the fundamental (that is, 360 1.22 s 60 hz). figure 59 illustrates how the phase compensation is used to remove a 0.1 phase lead in the current channel due to the external transducer. to cancel the lead (0.1) in the current channel, a phase lead must also be introduced into the voltage channel. the resolution of the phase adjustment allows the introduction of a phase lead in increments of 0.026. the phase lead is achieved by introducing a time advance into the voltage channel. a time advance of 4.88 s is made by writing ?4 (0x3c) to the time delay block, thus reducing the amount of time delay by 4.88 s or, equivalently, a phase lead of approximately 0.1 at a line frequency of 60 hz (0x3c represents ?4 because the register is centered with 0 at 0x40). 110100 1 70 pga1 i pa i n i adc 1 hpf 24 pga2 v p v n v adc 2 24 lpf2 v i 60hz 0.1 i v channel 2 delay reduced by 4.88s (0.1lead at 60hz) 0x0b in phcal[7:0] phcal[7:0] ?231.93s to +48.83s 60hz 1 1 delay block 1.22s/lsb 06353-035 figure 59. phase calibration rms calculation the root mean square (rms) value of a continuous signal v(t) is defined as = (3) for time sampling signals, rms calculation involves squaring the signal, taking the average, and obtaining the square root. the ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 implement this method by serially squaring the inputs, averaging them, and then taking the square root of the average. the averaging part of this signal processing is done by implementing a low-pass filter (lpf3 in figure 60 , figure 62 , and figure 63 ). this lpf has a ?3 db cutoff frequency of 2 hz when mclk = 4.096 mhz. () )sin(2 tvtv ?= (4) where v is the rms voltage. ( ?= 2cos )( 22 2 ) (5) when this signal goes through lpf3, the cos(2t) term is attenu- ated and only the dc term, v rms 2 (shown as v 2 in figure 60 ) goes through. v lpf3 input v 2 ( t ) = v 2 ? v 2 cos (2 & t ) v 2 ( t ) = v 2 v ( t ) = 2 v sin( & t ) 06353-036 figure 60. rms signal processing the i rms signal can be read from the waveform register by setting the wavmode register (address 0x0d) and setting the wfsm bit (bit 5) in the interrupt enable 3 sfr (mirqenh, address 0xdb). like the current and voltage channel waveform sampling modes, the waveform data is available at sample rates of 25.6 ksps, 12.8 ksps, 6.4 ksps, and 3.2 ksps. it is important to note that when the current input is larger than 40% of full scale, the i rms waveform sample register does not represent the true processed rms value. the rms value processed with this level of input is larger than the 24-bit read by the wave- form register, making the value read truncated on the high end. current channel rms calculation each ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 simultaneously calculates the rms values for the current and voltage channels in different registers. figure 61 and figure 62 show the details of the signal processing chain for the rms calculation on the current channel. the current channel rms value is processed from the samples used in the current channel waveform sampling mode and is stored in an unsigned 24-bit register (i rms ). one lsb of the current channel rms register is equivalent to 1 lsb of a current channel waveform sample.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 60 of 152 current channel rms offset compensation the update rate of the current channel rms measurement is 4.096 mhz/5. to minimize noise in the reading of the register, the i rms register can also be configured to update only with the zero crossing of the voltage input. this configuration is done by setting the zxrms bit (bit 2) in the mode2 register (address 0x0c). the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 incorporate a current channel rms offset compensa- tion register (irmsos). this is a 12-bit signed register that can be used to remove offset in the current channel rms calculation. an offset can exist in the rms calculation due to input noises that are integrated into the dc component of v 2 (t). with the different specified full-scale analog input signal pga1 values, the adc produces an output code that is approximately 0d2,147,483 (pga1 = 1) or 0d2,684,354 (pga1 = 2, 4, 8, or 16); see the current channel adc section. similarly, the equivalent rms value of a full-scale ac signal is 0d1,518,499 (0x172ba3) when pga = 1 and 0d1,898,124 (0x1cf68c) when pga1 = 2, 4, 8, or 16. one lsb of the current channel rms offset is equivalent to 16,384 lsbs of the square of the current channel rms register. assuming that the maximum value from the current channel rms calculation is 0d1,898,124 with full-scale ac inputs, then 1 lsb of the current channel rms offset represents 0.23% of measurement error at ?60 db down from full scale. the current rms measurement provided in the ADE7116/ ade7156/ade7166/ade7169/ade7566/ade7569 is accurate to within 0.5% for signal inputs between full scale and full scale/500. the conversion from the register value to amps must be done externally in the microprocessor using an amps/lsb constant. 768,32 2 += irmsos ii 0 rms rms (6) where i rms0 is the rms measurement without offset correction. i rms (t) 0x00 + irmsos[11:0] i rms [23:0] 2 26 2 25 sgn 2 27 2 17 2 16 2 18 24 24 dt mode1[5] current channel waveform data range with integrator off 0xd70a3e 0x000000 0x28f5c2 60hz 0xd487b0 0x2b7850 0x000000 current channel waveform data range with integrator on (60hz) hpf1 digital integrator* lpf3 06353-037 hpf i p *not available in the ade7566. figure 61. ade7566/ade7569 current channel rms signal processing with pga1 = 1, 2, 4, 8, or 16
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 61 of 152 i rms (t) 0x00 + irmsos[11:0] i rms [23:0] 2 26 2 25 sgn 2 27 2 17 2 16 2 18 24 24 dt hpf mode1[5] hpf current channel waveform data range with integrator off 0xd70a3e 0x000000 0x28f5c2 60hz 0xd487b0 i pa i pb 0x2b7850 0x000000 current channel waveform data range with integrator on (60hz) hpf1 digital integrator* lpf3 06353-116 ibgain *not available in the ADE7116, ade7156, or ade7166. figure 62. ADE7116/ade7156/ade7166/ade7169 current channel rms signal processing with pga1 = 2, 4, 8, or 16 06353-038 lpf3 lpf1 voltage channel 0x28f5c2 + + vrmsos[11:0] v oltage signal (v(t)) 0x28f5 0x0 0xd70b 2 16 sgn 2 15 2 7 2 6 2 8 v rmsx (t) 0x00 v rmsx [23:0] | x | figure 63. voltage channel rms signal processing
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 62 of 152 voltage channel rms calculation figure 63 shows details of the signal processing chain for the rms calculation on the voltage channel. this voltage rms estimation is done in the ADE7116/ade7156/ade7166/ade7169/ ade7566/ade7569 using the mean absolute value calculation, as shown in figure 63 . the voltage channel rms value is processed from the samples used in the voltage channel waveform sampling mode and is stored in the unsigned 24-bit v rms register. the update rate of the voltage channel rms measurement is mclk/5. to minimize noise in the reading of the register, the v rms register can also be configured to update only with the zero crossing of the voltage input. this configuration is done by setting the zxrms bit (bit 2) in the mode2 register (address 0x0c). with the specified full-scale ac analog input signal of 0.4 v, the output from lpf1 in figure 63 swings between 0x28f5 and 0xd70b at 60 hz (see the volt age c hannel ad c section). the equivalent rms value of this full-scale ac signal is approximately 0d1,898,124 (0x1cf68c) in the v rms register. the voltage rms measurement provided in the ADE7116/ade7156/ade7166/ ade7169/ade7566/ade7569 is accurate to within 0.5% for signal input between full scale and full scale/20. the conversion from the register value to volts must be done externally in the microprocessor using a v/lsb constant. voltage channel rms offset compensation the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 incorporate a voltage channel rms offset compensation register (vrmsos). this is a 12-bit signed register that can be used to remove offset in the voltage channel rms calculation. an offset can exist in the rms calculation due to input noises and dc offset in the input samples. one lsb of the voltage channel rms offset is equivalent to 64 lsbs of the rms register. assuming that the maximum value from the voltage channel rms calculation is 0d1,898,124 with full-scale ac inputs, then 1 lsb of the voltage channel rms offset represents 3.37% of measurement error at ?60 db down from full scale. v rms = v rms0 + 64 vrmsos (7) where v rms0 is the rms measurement without offset correction. active power calculation active power is defined as the rate of energy flow from source to load. it is the product of the voltage and current waveforms. the resulting waveform is called the instantaneous power signal and is equal to the rate of energy flow at every instant of time. the unit of power is the watt or joules/second. equation 8 gives an expression for the instantaneous power signal in an ac system. () )sin(2 tvtv ?= (8) () )sin(2 titi ?= (9) where: v is the rms voltage. i is the rms current. )()()( titvtp = )2cos( )( tvivitp ? = (10) the average power over an integral number of line cycles (n) is given by the expression in equation 11. = = nt vidttp nt p 0 )( 1 (11) where: t is the line cycle period. p is referred to as the active or real power. note that the active power is equal to the dc component of the instantaneous power signal p(t) in equation 11, that is, vi. this is the relationship used to calculate active power in the ADE7116/ ade7156/ade7166/ade7169/ade7566/ade7569. the instan- taneous power signal p(t) is generated by multiplying the current and voltage signals. the dc component of the instantaneous power signal is then extracted by lpf2 (low-pass filter) to obtain the active power information. this process is illustrated in figure 64 . instantaneous power signal p(t) = v i v i cos(2 t) active real power signal = v i 0x19999a vi 0xccccd 0x00000 current i(t) = 2 i sin( t) voltage v(t) = 2 v sin( t) 06353-039 figure 64. active power calculation because lpf2 does not have an ideal brick wall frequency response (see figure 65 ), the active power signal has some ripple due to the instantaneous power signal. this ripple is sinusoidal and has a frequency equal to twice the line frequency. because of its sinusoidal nature, the ripple is removed when the active power signal is integrated to calculate energy (see the active energy calculation section).
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 63 of 152 frequency (hz) ?24 1 (db) ?20 31 03 01 ?12 ?16 ?8 ?4 0 06353-040 0 0 figure 65. frequency response of lpf2 active power gain calibration figure 66 shows the signal processing chain for the active power calculation in the ADE7116/ade7156/ade7166/ade7169/ ade7566/ade7569. the active power is calculated by filtering the output of the multiplier with a low-pass filter. note that , when re ading the waveform samples from the output of lpf2, the gain of the active energy can be adjusted by using the multi- plier and watt gain register (wgain[11:0], address 0x1d). the gain is adjusted by writing a twos complement 12-bit word to the watt gain register. equation 12 shows how the gain adjustment is related to the contents of the watt gain register. ? ? ? ? ? ? ? ? ? ? ? ? ? ? + = (12) for example, when 0x7ff is written to the watt gain register, the power output is scaled up by 50% (0x7ff = 2047d, 2047/2 12 = 0.5). similarly, 0x800 = ?2048d (signed, twos complement) and power output is scaled by ?50%. each lsb scales the power output by 0.0244%. the minimum output range is given when the watt gain register contents are equal to 0x800, and the maximum range is given by writing 0x7ff to the watt gain register. this can be used to calibrate the active power (or energy) calculation in the ADE7116/ade7156/ade7166/ ade7169/ade7566/ade7569. active power offset calibration the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 also incorporate an active power offset register (wattos[15:0], address 0x20). it is a signed, twos complement, 16-bit register that can be used to remove offsets in the active power calculation (see figure 64 ). an offset can exist in the power calculation due to crosstalk between channels on the pcb or in the ic itself. the offset calibration allows the contents of the active power register to be maintained at 0 when no power is being consumed. the 256 lsbs (wattos = 0x0100) written to the active power offset register are equivalent to 1 lsb in the waveform sample register. assuming the average value, output from lpf2 is 0xccccd (838,861d) when inputs on the voltage and current channels are both at full scale. at ?60 db down on the current channel (1/1000 of the current channel full-scale input), the average word value output from lpf2 is 838.861 (838,861/1000). one lsb in the lpf2 output has a measurement error of 1/838.861 100% = 0.119% of the average value. the active power offset register has a resolution equal to 1/256 lsb of the waveform register. therefore, the power offset correction resolution is 0.000464%/lsb (0.119%/256) at ?60 db. active power sign detection the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 detect a change of sign in the active power. the apsign flag (bit 3) in the interrupt status 1 sfr (mirqstl, address 0xdc) records when a change of sign has occurred according to the apsign bit (bit 4) in the accmode register (address 0x0f). if the apsign flag (bit 3) is set in the interrupt enable 1 sfr (mirqenl, address 0xd9), the 8052 core has a pending ade interrupt. the ade interrupt stays active until the apsign status bit is cleared (see the energy measurement interrupts section). when apsign (bit 4) in the accmode register (address 0x0f) is cleared (default), the apsign flag (bit 3) in the interrupt status 1 sfr (mirqstl, address 0xdc) is set when a transition from positive to negative active power occurs. when the apsign bit (bit 4) in the accmode register (address 0x0f) is set, the apsign flag (bit 3) in the mirqstl sfr (address 0xdc) is set when a transition from negative to positive active power occurs. active power no load detection the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 include a no load threshold feature on the active energy that eliminates any creep effects in the meter. the part accomplishes this by not accumulating energy if the multiplier output is below the no load threshold. when the active power is below the no load threshold, the apnoload flag (bit 0) in the interrupt status 1 sfr (mirqstl, address 0xdc) is set. if the apnoload bit (bit 0) is set in the interrupt enable 1 sfr (mirqenl, address 0xd9), the 8052 core has a pending ade interrupt. the ade interrupt stays active until the apnoload status bit is cleared (see the energy measurement interrupts section). the no load threshold level is selectable by setting the apnoload bits (bits[1:0]) in the nlmode register (address 0x0e). setting these bits to 0b00 disables the no load detection, and setting them to 0b01, 0b10, or 0b11 sets the no load detection threshold to 0.015%, 0.0075%, or 0.0037% of the multipliers full-scale output frequency, respectively. the iec 62053-21 specification states that the meter must start up with a load of 0.4% i pb , which translates to 0.0167% of the full-scale output frequency of the multiplier.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 64 of 152 active energy calculation as stated in the active power calculation section, power is defined as the rate of energy flow. this relationship can be expressed mathematically, as shown in equation 13. dt de p = (13) where: p is power. e is energy. conversely, energy is given as the integral of power. = dttpe )( (14) the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 achieve the integration of the active power signal by continuously accumulating the active power signal in an internal, nonreadable, 49-bit energy register. the register (watthr[23:0], address 0x01) represents the upper 24 bits of this internal register. this discrete time accumulation or summation is equivalent to integration in continuous time. equation 15 expresses the relationship. ? ? ? ? ? ? == = 1 0 )(lim)( n t tntp dttpe (15) where: n is the discrete time sample number. t is the sample period. the discrete time sample period (t) for the accumulation register in the ADE7116/ade7156/ade7166/ade7169/ ade7566/ade7569 is 1.22 s (5/mclk). in addition to calculating the energy, this integration removes any sinusoidal components that may be in the active power signal. figure 66 shows this discrete time integration or accumulation. the active power signal in the waveform register is continuously added to the internal active energy register. the active energy accumulation depends on the setting of poam (bit 1) and absam (bit 0) in the accmode register (address 0x0f). when both bits are cleared, the addition is signed and, therefore, negative energy is subtracted from the active energy contents. when both bits are set, the ade7166/ ade7169/ade7566/ade7569 are set to be in the more restrictive mode, the positive-only accumulation mode. when poam (bit 1) in the accmode register (address 0x0f) is set, only positive power contributes to the active energy accumulation. when absam (bit 0) in the accmode register (address 0x0f) is set, the absolute active power is used for the active energy accumulation (see the watt -ab s olute accumulation mode section). the output of the multiplier is divided by the value in the wdiv register (address 0x24). if the value in the wdiv register is equal to 0, the internal active energy register is divided by 1. wdiv is an 8-bit, unsigned register. after dividing by wdiv, the active energy is accumulated in a 49-bit internal energy accumulation register. the upper 24 bits of this register are accessible through a read to the active energy register (watthr[23:0], address 0x01). a read to the rwatthr register (address 0x02) returns the contents of the watthr register, and the upper 24 bits of the internal register are cleared. as shown in figure 66 , the active power signal is accumulated in an internal 49-bit signed register. the active power signal can be read from the waveform register by setting the wavmode register (address 0x0d) and setting the wfsm bit (bit 5) in the interrupt enable 3 sfr (mirqenh, address 0xdb). like the current and voltage channels waveform sampling modes, the waveform data is available at sample rates of 25.6 ksps, 12.8 ksps, 6.4 ksps, and 3.2 ksps. wgain[11:0] wdiv[7:0] lpf2 current channel v oltage c hannel output lpf2 time (nt) 5 clkin t active power signal + + watthr[23:0] outputs from the lpf2 are accumulated (integrated) in the internal active energy register upper 24 bits are accessible through watthr[23:0] register 23 0 48 0 % wattos[15:0] 2 6 sgn 2 5 2 ?6 2 ?7 2 ?8 + + for waveform sampling to digital-to-frequency converter waveform register values 0 6353-041 figure 66. active energy calculation
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 65 of 152 figure 67 shows this energy accumulation for full-scale signals (sinusoidal) on the analog inputs. the three displayed curves illustrate the minimum period of time it takes the energy register to roll over when the active power gain register contents are 0x7ff, 0x000, and 0x800. the watt gain register is used to carry out power calibration in the ADE7116/ade7156/ade7166/ ade7169/ade7566/ade7569. as shown, the fastest integration time occurs when the watt gain register is set to maximum full scale, that is, 0x7ff. 0x00,0000 0x7f,fff f 0x3f,fff f 0x40,0000 0x80,0000 w a tthr[23:0] 6.82 3.41 10.2 13.7 time (minutes) wgain = 0x7ff wgain = 0x000 wgain = 0x800 0 6353-042 figure 67. energy register rollov er time for full-scale power (minimum and maximum power gain) note that the energy register contents roll over to full-scale negative (0x800000) and continue to increase in value when the power or energy flow is positive (see figure 67 ). conversely, if the power is negative, the energy register underflows to full- scale positive (0x7fffff) and continues to decrease in value. using the interrupt enable register (mirqenm, address 0xda), the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 can be configured to issue an ade interrupt to the 8052 core when the active energy register is half full (positive or negative) or when an overflow or underflow occurs. integration time under stea dy load: active energy as mentioned in the active energy calculation section, the discrete time sample period (t) for the accumulation register is 1.22 s (5/mclk). with full-scale sinusoidal signals on the analog inputs and the wgain register (address 0x1d) set to 0x000, the average word value from each lpf2 is 0xccccd (see figure 64 ). the maximum positive value that can be stored in the internal 49-bit register is 2 48 (or 0xffff,ffff,ffff) before it overflows. the integration time under these conditions when wdiv = 0 is calculated in the following equation: time = min82.6sec6.409s22.1 xccccd0 ffffffff, xffff,0 = =? (16) when wdiv is set to a value other than 0, the integration time varies, as shown in equation 17. time = time wdiv = 0 wdiv (17) active energy ac cumulation modes watt -sig n e d ac c u mu lati on mo d e the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 active energy default accumulation mode is a watt- signed accumulation based on the active power information. watt positive-only accumulation mode the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 are placed in watt positive-only accumulation mode by setting the poam bit (bit 1) in the accmode register (address 0x0f). in this mode, the energy accumulation is done only for positive power, ignoring any occurrence of negative power above or below the no load threshold (see figure 68 ). the cf pulse also reflects this accumulation method when in this mode. the default setting for this mode is off. detection of the transitions in the direction of power flow and detection of no load threshold are active in this mode. pos pos interrupt status registers neg apsign flag no-load threshold active power no-load threshold active energy 0 6353-043 figure 68. energy accumulation in positive-only accumulation mode watt-absolute accumulation mode the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 are placed in watt-absolute accumulation mode by setting the absam bit (bit 0) in the accmode register (address 0x0f). in this mode, the energy accumulation is done using the absolute active power, ignoring any occurrence of power below the no load threshold (see figure 69 ). the cf pulse also reflects this accumulation method when in this mode. the default setting for this mode is off. detection of the transitions in the direction of power flow, and detection of no load threshold are active in this mode.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 66 of 152 pos pos interrupt status registers neg apsign flag no-load threshold active power no-load threshold a ctive energy apnoload apnoload 06353-044 figure 69. energy accumulation in absolute accumulation mode active energy pulse output all of the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 circuitry has a pulse output whose frequency is proportional to active power (see the active power calculation section). this pulse frequency output uses the calibrated signal from the wgain register (address 0x1d) output, and its behavior is consistent with the setting of the active energy accumulation mode in the accmode register (address 0x0f). the pulse output is active low and should preferably be connected to an led, as shown in figure 80 . line cycle active energy accumulation mode in line cycle active energy accumulation mode, the energy accumu- lation of the ADE7116/ade7156/ade7166/ade7169/ ade7566/ade7569 can be synchronized to the voltage channel zero crossing so that active energy can be accumulated over an integral number of half-line cycles. the advantage of summing the active energy over an integer number of line cycles is that the sinusoidal component in the active energy is reduced to 0. this eliminates any ripple in the energy calculation. energy is calculated more accurately and more quickly because the integration period can be shortened. by using this mode, the energy calibration can be greatly simplified, and the time required to calibrate the meter can be significantly reduced. in the line cycle active energy accumulation mode, the ADE7116/ ade7156/ade7166/ade7169/ade7566/ade7569 accumulate the active power signal in the lwatthr register (address 0x03) for an integral number of line cycles, as shown in figure 70 . the number of half-line cycles is specified in the lincyc register. the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 can accumulate active power for up to 65,535 half- line cycles. because the active power is integrated on an integral number of line cycles, the cycend flag (bit 2) in the interrupt status 3 sfr (mirqsth, address 0xde) is set at the end of an active energy accumulation line cycle. if the cycend enable bit (bit 2) in the interrupt enable 3 sfr (mirqenh, address 0xdb) is set, the 8052 core has a pending ade interrupt. the ade interrupt stays active until the cycend status bit is cleared (see the energy measurement interrupts section). another calibration cycle starts as soon as the cycend flag is set. if the lwatthr register (address 0x03) is not read before a new cycend flag is set, the lwatthr register is overwritten by a new value. wdiv[7:0] wattos[15:0] wgain[11:0] lpf1 + + lwatthr[23:0] active energy is accumulated in the internal register, and the lwatthr register is updated at the end of the lincyc half-line cycles output from lpf2 from voltage channel adc 23 0 lincyc[15:0] 48 0 % zero-crossing detection calibration control to digital-to-frequency converter 06353-046 figure 70. line cycle active energy accumulation
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 67 of 152 when a new half-line cycle is written in the lincyc register (address 0x12), the lwatthr register (address 0x03) is reset, and a new accumulation starts at the next zero crossing. the number of half-line cycles is then counted until lincyc is reached. this implementation provides a valid measurement at the first cycend interrupt after writing to the lincyc register (see figure 71 ). the line active energy accumulation uses the same signal path as the active energy accumulation. the lsb size of these two registers is equivalent. lincyc value cycend irq lwatthr register 06353-045 figure 71. energy accumulation when lincyc changes using the information from equation 10 and equation 11, () () dtft f vi dtvite nt nt ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? + ?= 2cos 9.8 1 0 2 0 (18) where: n is an integer. t is the line cycle period. because the sinusoidal component is integrated over an integer number of line cycles, its value is always 0. therefore, 0 0 += nt vidte (19) e ( t ) = vint (20) note that in this mode, the 16-bit lincyc register can hold a maximum value of 65,535. in other words, the line energy accumulation mode can be used to accumulate active energy for a maximum duration of over 65,535 half-line cycles. at a 60 hz line frequency, it translates to a total duration of 65,535/120 hz = 546 sec. reactive power calculation (ade7169/ade7569) reactive power, a function available for the ade7169/ade7569 only, is defined as the product of the voltage and current wave- forms when one of these signals is phase-shifted by 90. the resulting waveform is called the instantaneous reactive power signal. equation 23 gives an expression for the instantaneous reactive power signal in an ac system when the phase of the current channel is shifted by 90. )sin(2)( tvtv + = (21) )sin(2)( titi = ? ? ? ? ? ? + = 2 sin2)( titi (22) where: is the phase difference between the voltage and current channel. v is the rms voltage. i is the rms current. q ( t ) = v ( t ) i ( t ) (23) q ( t ) = vi sin () + vi sin )2( + t the average reactive power over an integral number of lines (n) is given in equation 24. = = nt vidttq nt q 0 )sin()( 1 (24) where: t is the line cycle period. q is referred to as the reactive power. note that the reactive power is equal to the dc component of the instantaneous reactive power signal q(t) in equation 23. the instantaneous reactive power signal q(t) is generated by multiplying the voltage and current channels. in this case, the phase of the current channel is shifted by 90. the dc component of the instantaneous reactive power signal is then extracted by a low-pass filter to obtain the reactive power information (see figure 72 ). in addition, the phase-shifting filter has a nonunity magnitude response. because the phase-shifted filter has a large attenuation at high frequency, the reactive power is primarily for calculation at line frequency. the effect of harmonics is largely ignored in the reactive power calculation. note that, because of the mag- nitude characteristic of the phase shifting filter, the weight of the reactive power is slightly different from the active power calculation (see the energy register scaling section). the frequency response of the lpf in the reactive signal path is identical to the one used for lpf2 in the average active power calculation. because lpf2 does not have an ideal brick wall frequency response (see figure 65 ), the reactive power signal has some ripple due to the instantaneous reactive power signal. this ripple is sinusoidal and has a frequency equal to twice the line frequency. because the ripple is sinusoidal in nature, it is removed when the reactive power signal is integrated to calculate energy. the reactive power signal can be read from the waveform register by setting the wavmode register (address 0x0d) and the wfsm bit (bit 5) in the interrupt enable 3 sfr (mirqenh, address 0xdb). like the current and voltage channels waveform sampling modes, the waveform data is available at sample rates of 25.6 ksps, 12.8 ksps, 6.4 ksps, and 3.2 ksps.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 68 of 152 reactive power gain calibration figure 72 shows the signal processing chain for the ade7169/ ade7569 reactive power calculation. as explained in the reactive power calculation (ade7169/ade7569) section, the reactive power is calculated by applying a low-pass filter to the instantaneous reactive power signal. note that, when reading the waveform samples from the output of lpf2, the gain of the reactive energy can be adjusted by using the multiplier and by writing a twos complement, 12-bit word to the var gain register (vargain[11:0], address 0x1e). equation 25 shows how the gain adjustment is related to the contents of the var gain register. output vargain = ? ? ? ? ? ? ? ? ? ? ? ? + 12 2 1 vargain power reactive (25) the resolution of the vargain register is the same as the wgain register (see the active power gain calibration section). vargain can be used to calibrate the reactive power (or energy) calculation in the ade7169/ade7569. reactive power o ffset calibration the ade7169/ade7569 also incorporate a reactive power offset register (varos[15:0], address 0x21). this signed, twos complement, 16-bit register can be used to remove offsets in the reactive power calculation (see figure 72 ). an offset can exist in the reactive power calculation due to crosstalk between channels on the pcb or in the ic itself. the offset calibration allows the contents of the reactive power register to be maintained at 0 when no power is being consumed. the 256 lsbs (varos = 0x100) written to the reactive power offset register are equivalent to 1 lsb in the wavmode register (address 0x0d). sign of reactive power calculation note that the average reactive power is a signed calculation. the phase shift filter has ?90 phase shift when the integrator is enabled, and +90 phase shift when the integrator is disabled. table 46 summarizes the relationship of the phase difference between the voltage and the current and the sign of the resulting var calculation. table 46. sign of reactive power calculation angle integrator sign between 0 to +90 off positive between ?90 to 0 off negative between 0 to +90 on positive between ?90 to 0 on negative reactive power sign detection the ade7169/ade7569 detect a change of sign in the reactive power. the varsign flag (bit 4) in the interrupt status 1 sfr (mirqstl, address 0xdc) records when a change of sign has occurred according to the varsign bit (bit 5) in the accmode register (address 0x0f). if the varsign bit is set in the interrupt enable 1 sfr (mirqenl, address 0xd9), the 8052 core has a pending ade interrupt. the ade interrupt stays active until the varsign status bit is cleared (see the energy measurement interrupts section). when varsign (bit 5) in the accmode register (address 0x0f) is cleared (default), the varsign flag (bit 4) in the interrupt status 1 sfr (mirqstl, address 0xdc) is set when a transition from positive to negative reactive power occurs. when varsign in the accmode register (address 0x0f) is set, the varsign flag in the interrupt status 1 sfr (mirqstl, address 0xdc) is set when a transition from negative to positive reactive power occurs. reactive power no load detection the ade7169/ade7569 include a no load threshold feature on the reactive energy that eliminates any creep effects in the meter. the ade7169/ade7569 accomplish this by not accumulating reactive energy when the multiplier output is below the no load threshold. when the reactive power is below the no load threshold, the rnoload flag (bit 1) in the interrupt status 1 sfr (mirqstl, address 0xdc) is set. if the rnoload bit (bit 1) is set in the interrupt enable 1 sfr (mirqenl, address 0xd9), the 8052 core has a pending ade interrupt. the ade interrupt stays active until the rnoload status bit is cleared (see the energy measurement interrupts section). the no load threshold level is selectable by setting the varnoload bits (bits[3:2]) in the nlmode register (address 0x0e). setting these bits to 0b00 disables the no load detection, and setting them to 0b01, 0b10, or 0b11 sets the no load detection threshold to 0.015%, 0.0075%, and 0.0037% of the full-scale output frequency of the multiplier, respectively. reactive energy calculation (ade7169/ade7569) as for active energy, the ade7169/ade7569 achieve the integration of the reactive power signal by continuously accumulating the reactive power signal in an internal, nonreadable, 49-bit energy register. the reactive energy register (varhr[23:0], address 0x04) represents the upper 24 bits of this internal register. the varhr register and its function are available for the ade7169/ade7569 only. the discrete time sample period (t) for the accumulation register in the ade7169/ade7569 is 1.22 s (5/mclk). as well as calculating the energy, this integration removes any sinusoidal components that may be in the active power signal. figure 72 shows this discrete time integration or accumulation. the reactive power signal in the waveform register is continuously added to the internal reactive energy register.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 69 of 152 the reactive energy accumulation depends on the setting of the savarm and absvarm bits in the accmode register (address 0x0f). when both bits are cleared, the addition is signed and, therefore, negative energy is subtracted from the reactive energy contents. when both bits are set, the ade7169/ade7569 are set to be in the more restrictive mode, which is the absolute accumulation mode. when the savarm bit (bit 2) in the accmode register (address 0x0f) is set, the reactive power is accumulated depending on the sign of the active power. when the active power is positive, the reactive power is added as it is to the reactive energy register. when the active power is negative, the reactive power is subtracted from the reactive energy accumulator (see the var a nt it amp e r accumulation mode section). when the absvarm bit (bit 3) in the accmode register (address 0x0f) is set, the absolute reactive power is used for the reactive energy accumulation (see the var ab s olute accumulation mode section). the output of the multiplier is divided by vardiv. if the value in the vardiv register (address 0x25) is equal to 0, the internal reactive energy register is divided by 1. vardiv is an 8-bit, unsigned register. after dividing by vardiv, the reactive energy is accumulated in a 49-bit internal energy accumulation register. the upper 24 bits of this register are accessible through a read to the reactive energy register (varhr[23:0], address 0x04). a read to the rvahr register (address 0x08) returns the content of the varhr register, and the upper 24 bits of the internal register are cleared. as shown in figure 72 , the reactive power signal is accumulated in an internal 49-bit, signed register. the reactive power signal can be read from the waveform register by setting the wavmode register (address 0x0d) and setting the wfsm bit (bit 5) in the interrupt enable 3 sfr (mirqenh, address 0xdb). like the current and voltage channel waveform sampling modes, the wave- form data is available at sample rates of 25.6 ksps, 12.8 ksps, 6.4 ksps, and 3.2 ksps. figure 67 shows this energy accumulation for full-scale signals (sinusoidal) on the analog inputs. these curves also apply for the reactive energy accumulation. note that the energy register contents roll over to full-scale negative (0x800000) and continue to increase in value when the power or energy flow is positive. conversely, if the power is negative, the energy register underflows to full-scale positive (0x7fffff) and continues to decrease in value. using the interrupt enable 2 sfr (mirqenm, address 0xda), the ade7169/ade7569 can be configured to issue an ade interrupt to the 8052 core when the reactive energy register is half-full (positive or negative) or when an overflow or underflow occurs. vargain[11:0] vardiv[7:0] lpf2 current channel voltage channel output lpf2 time (nt) 5 clkin t reactive power signal + + varhr[23:0] upper 24 bits are accessible through varhr[23:0] register 23 0 48 0 waveform register values % varos[15:0] 2 6 sgn 2 5 2 ?6 2 ?7 2 ?8 + + for waveform sampling hpf 2 phcal[7:0] 90 phase shifting filter 06353-047 outputs from the lpf2 are accumulated (integrated) in the internal reactive energy register to digital-to-frequency converter figure 72. reactive energy calculation
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 70 of 152 integration time under stea dy load: reactive energy as mentioned in the active energy calculation section, the discrete time sample period (t) for the accumulation register is 1.22 s (5/mclk). with full-scale sinusoidal signals on the analog inputs and the vargain register (address 0x1e) and the vardiv register (address 0x25) set to 0x000, the integration time before the reactive energy register overflows is calculated in equation 26. time = min82.6sec6.409s22.1 0xccccd ffffffff, 0xffff, = =? (26) when vardiv is set to a value different from 0, the integration time varies, as shown in equation 27. vardiv time time wdiv = = 0 (27) reactive energy accumulation modes var signed accumulation mode the ade7169/ade7569 reactive energy default accumulation mode is a signed accumulation based on the reactive power information. var antitamper accumulation mode the ade7169/ade7569 are placed in var antitamper accumulation mode by setting the savarm bit in the accmode register (address 0x0f). in this mode, the reactive power is accumulated depending on the sign of the active power. when the active power is positive, the reactive power is added as it is to the reactive energy register. when the active power is negative, the reactive power is subtracted from the reactive energy accumulator (see figure 73 ). the cf pulse also reflects this accumulation method when in this mode. the default setting for this mode is off. transitions in the direction of power flow and no load threshold are active in this mode. pos pos interrupt status registers neg apsign flag active power no-load threshold no-load threshold reactive energy no-load threshold reactive power no-load threshold 0 6353-048 figure 73. reactive energy accumulation in antitamper accumulation mode
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 71 of 152 line cycle reactive energy accumulation mode var absolute accumulation mode in line cycle reactive energy accumulation mode, the energy accumulation of the ade7169/ade7569 can be synchronized to the voltage channel zero crossing so that reactive energy can be accumulated over an integral number of half-line cycles. the advantages of this mode are similar to the ones described in the line cycle active energy accumulation mode section. the ade7169/ade7569 are placed in absolute accumulation mode by setting the absvarm bit (bit 3) in the accmode register (address 0x0f). in absolute accumulation mode, the reactive energy accumulation is done by using the absolute reactive power and ignoring any occurrence of power below the no load threshold for the reactive energy (see figure 74 ). the cf pulse also reflects this accumulation method when in the absolute accumulation mode. the default setting for this mode is off. transitions in the direction of power flow and no load threshold are active in this mode. in line cycle active energy accumulation mode, the ade7169/ade7569 accumulate the reactive power signal in the lvarhr register (address 0x06) for an integral number of line cycles, as shown in figure 75 . the number of half-line cycles is specified in the lincyc register (address 0x12). the ade7169/ade7569 can accumulate active power for up to 65,535 half-line cycles. reactive energy no-load threshold no-load threshold reactive power 0 6353-049 because the reactive power is integrated on an integral number of line cycles, the cycend flag (bit 2) in the interrupt status 3 sfr (mirqsth, address 0xde) is set at the end of an active energy accumulation line cycle. if the cycend enable bit (bit 2) in the interrupt enable 3 sfr (mirqenh, address 0xdb) is set, the 8052 core has a pending ade interrupt. the ade interrupt stays active until the cycend status bit is cleared (see the energy measurement interrupts section). another calibration cycle starts as soon as the cycend flag is set. if the lvarhr register (address 0x06) is not read before a new cycend flag is set, the lvarhr register is overwritten by a new value. figure 74. reactive energy accumulation in absolute accumulation mode reactive energy pulse output the ade7169/ade7569 provide all the circuitry with a pulse output whose frequency is proportional to reactive power (see the energy-to-frequency conversion section). this pulse frequency output uses the calibrated signal after vargain, and its behavior is consistent with the setting of the reactive energy accumulation mode in the accmode register (address 0x0f). the pulse output is active low and should preferably be connected to an led, as shown in figure 80 . when a new half-line cycle is written in the lincyc register (address 0x12), the lvarhr register is reset, and a new accumulation starts at the next zero crossing. the number of half-line cycles is then counted internally until the value programmed in lincyc is reached. this implementation provides a valid measurement at the first cycend interrupt after writing to the lincyc register. the line reactive energy accumulation uses the same signal path as the reactive energy accumulation. the lsb size of these two registers is equivalent. lpf1 + + output from lpf2 from voltage channel adc 23 0 lincyc[15:0] 48 0 % zero-crossing detection lvarhr[23:0] calibration control vardiv[7:0] varos[15:0] vargain[11:0] 06353-050 to digital-to-frequency converter active energy is accumulated in the internal register, and the lwatthr register is updated at the end of the lincyc half-line cycles figure 75. line cycle reactive energy accumulation mode
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 72 of 152 apparent power calculation apparent power is defined as the maximum power that can be delivered to a load. v rms and i rms are the effective voltage and current delivered to the load, respectively. therefore, the apparent power (ap) = v rms i rms . this equation is independent of the phase angle between the current and the voltage. equation 31 gives an expression of the instantaneous power signal in an ac system with a phase shift. () 2 sin( ) rms vt v t = (28) () )sin(2 + = titi rms (29) )()()( titvtp = (30) () )2cos( )cos( + ? = tiv ivtp rmsrms rmsrms (31) figure 76 illustrates the signal processing for the calculation of the apparent power in the ADE7116/ade7156/ade7166/ ade7169/ade7566/ade7569. the apparent power signal can be read from the waveform register by setting the wavmode register (address 0x0d) and setting the wfsm bit (bit 5) in the interrupt enable 3 sfr (mirqenh, address 0xdb). like the current and voltage channel waveform sampling modes, the waveform data is available at sample rates of 25.6 ksps, 12.8 ksps, 6.4 ksps, and 3.2 ksps. the gain of the apparent energy can be adjusted by using the multiplier and by writing a twos complement, 12-bit word to the vagain register (vagain[11:0], address 0x1f). equation 32 shows how the gain adjustment is related to the contents of the vag a i n r e g i s t e r. output vagain = ? ? ? ? ? ? ? ? ? ? ? ? + 12 2 1 vagain power apparent (32) for example, when 0x7ff is written to the vagain register, the power output is scaled up by 50% (0x7ff = 2047d, 2047/2 12 = 0.5). similarly, 0x800 = ?2047d (signed twos complement) and power output is scaled by ?50%. each lsb represents 0.0244% of the power output. the apparent power is calculated with the current and voltage rms values obtained in the rms blocks of the ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569. apparent power o ffset calibration each rms measurement includes an offset compensation register to calibrate and eliminate the dc component in the rms value (see the current channel rms calculation and the voltage channel rms calculation section). the voltage and current channels rms values are then multiplied together in the apparent power signal processing. because no additional offsets are created in the multiplication of the rms values, there is no specific offset compensation in the apparent power signal processing. the offset compensation of the apparent power measurement is done by calibrating each individual rms measurement. 06353-051 v rms i rms 0x1a36e2 apparent power signal (p) current rms signal i(t) voltage rms signal v(t) 0x00 0x1cf68c 0x00 0x1cf68c vagain to digital-to-frequency converter v armscfcon figure 76. apparent power signal processing
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 73 of 152 apparent energy calculation the apparent energy is given as the integral of the apparent power. = dttpower apparent energy apparent )( (33) the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 achieve the integration of the apparent power signal by continuously accumulating the apparent power signal in an internal 48-bit register. the apparent energy register (vahr[23:0], address 0x07) represents the upper 24 bits of this internal register. this discrete time accumulation or summation is equivalent to integration in continuous time. equation 34 expresses the relationship. ? ? ? ? ? ? = = 0 0 )( lim n t tntpower apparent energy apparent (34) where: n is the discrete time sample number. t is the sample period. the discrete time sample period (t) for the accumulation register in the ADE7116/ade7156/ade7166/ade7169/ ade7566/ade7569 is 1.22 s (5/mclk). figure 77 shows this discrete time integration or accumulation. the apparent power signal is continuously added to the internal register. this addition is a signed addition even if the apparent energy theoretically remains positive. the 49 bits of the internal register are divided by vadiv. if the value in the vadiv register (address 0x26) is 0, the internal apparent energy register is divided by 1. vadiv is an 8-bit, unsigned register. the upper 24 bits are then written in the 24-bit apparent energy register (vahr[23:0], address 0x07). the rvahr register (address 0x08), which is 24 bits long, is provided to read the apparent energy. this register is reset to 0 after a read operation. note that the apparent energy register is unsigned. by setting the vaehf bit (bit 2) and the vaeof bit (bit 5) in the interrupt enable 2 sfr (mirqenm, address 0xda), the device can be configured to issue an ade interrupt to the 8052 core when the apparent energy register is half-full or when an overflow occurs. the half-full interrupt for the unsigned apparent energy register is based on 24 bits as opposed to 23 bits for the signed active energy register. integration time under stea dy load: apparent energy as mentioned in the apparent energy calculation section, the discrete time sample period (t) for the accumulation register is 1.22 s (5/mclk). with full-scale sinusoidal signals on the analog inputs and the vagain register (address 0x1f) set to 0x000, the average word value from the apparent power stage is 0x1a36e2 (see the apparent power calculation section). the maximum value that can be stored in the apparent energy register before it overflows is 2 24 or 0xff,ffff. the average word value is added to the internal register, which can store 2 48 or 0xffff,ffff,ffff before it overflows. therefore, the integration time under these conditions with vadiv = 0 is calculated as follows: time = min33.3sec199s22.1 0xd055 ffffffff, 0xffff, ==? (35) when vadiv is set to a value different from 0, the integration time varies, as shown in equation 36. time = time wdiv = 0 vadiv (36) 06353-052 vadiv apparent power or i rms + + v ahr[23:0] appa re nt power or i rms is accumulated (integrated) in the apparent energy register 23 0 48 0 48 0 % time (nt) t apparent power signal = p figure 77. apparent energy calculation
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 74 of 152 apparent energy pulse output all the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 circuitry has a pulse output whose frequency is proportional to apparent power (see the energy-to-frequency conversion section). this pulse frequency output uses the calibrated signal after vagain. this output can also be used to output a pulse whose frequency is proportional to i rms . the pulse output is active low and should preferably be connected to an led, as shown in figure 80 . line apparent energy accumulation the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 are designed with a special apparent energy accumulation mode that simplifies the calibration process. by using the on-chip, zero-crossing detection, the ADE7116/ ade7156/ade7166/ade7169/ade7566/ade7569 accumulate the apparent power signal in the lvahr register (address 0x09) for an integral number of half cycles, as shown in figure 78 . the line apparent energy accumulation mode is always active. the number of half-line cycles is specified in the lincyc register (address 0x12), which is an unsigned 16-bit register. the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 can accumulate apparent power for up to 65,535 combined half cycles. because the apparent power is integrated on the same integral number of line cycles as the line active register and reactive energy register, these values can easily be compared. the energies are calculated more accurately because of this precise timing control and provide all the information needed for reactive power and power factor calculation. at the end of an energy calibration cycle, the cycend flag (bit 2) in the interrupt status 3 sfr (mirqsth, address 0xde) is set. if the cycend enable bit (bit 2) in the interrupt enable 3 sfr (mirqenh, address 0xdb) is enabled, the 8052 core has a pending ade interrupt. as for lwatthr, when a new half-line cycle is written in the lincyc register (address 0x12), the lvahr register (address 0x09) is reset and a new accumulation starts at the next zero crossing. the number of half-line cycles is then counted until lincyc is reached. this implementation provides a valid measurement at the first cycend interrupt after writing to the lincyc register. the line apparent energy accumulation uses the same signal path as the apparent energy accumulation. the lsb size of these two registers is equivalent. apparent power no load detection the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 include a no load threshold feature on the apparent power that eliminates any creep effects in the meter. the ADE7116/ ade7156/ade7166/ade7169/ade7566/ade7569 accomplish this by not accumulating energy if the multiplier output is below the no load threshold. when the apparent power is below the no load threshold, the vanoload flag (bit 2) in the interrupt status 1 sfr (mirqstl, address 0xdc) is set. if the vanoload bit (bit 2) is set in the interrupt enable 1 sfr (mirqenl, address 0xd9), the 8052 core has a pending ade interrupt. the ade interrupt stays active until the apnoload status bit is cleared (see the energy measurement interrupts section). the no load threshold level is selectable by setting the vanoload bits (bits[5:4]) in the nlmode register (address 0x0e). setting these bits to 0b00 disables the no load detection, and setting them to 0b01, 0b10, or 0b11 sets the no load detection threshold to 0.030%, 0.015%, and 0.0075% of the full- scale output frequency of the multiplier, respectively. this no load threshold can also be applied to the i rms pulse output when selected. in this case, the level of no load threshold is the same as for the apparent energy. ampere-hour accumulation in a tampering situation where no voltage is available to the energy meter, the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 are capable of accumulating the ampere-hour instead of apparent power into the vahr, rvahr, and lvahr. when the varmscfcon bit (bit 3) of the mode2 register (address 0x0c) is set, the vahr, rvahr, and lvahr, and the input for the digital-to-frequency converter accumulate i rms instead of apparent power. all the signal processing and calibration registers available for apparent power and energy accumulation remain the same when ampere-hour accumulation is selected. however, the scaling difference between i rms and apparent power requires independent values for gain calibration in the vagain (address 0x1f), vadiv (address 0x26), cfxnum (address 0x27 and address 0x29), and cfxden (address 0x28 and address 0x2a) registers.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 75 of 152 06353-053 lpf1 + + lvahr[23:0] lvahr register is updated every lincyc zero crossing with the total apparent energy during that duration from voltage channel adc 23 0 lincyc[15:0] 48 0 % zero-crossing detection calibr ation control vadiv[7:0] apparent power or i rms figure 78. line cycle apparent energy accumulation energy-to-freque ncy conversion the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 also provide two energy-to-frequency conversions for calibration purposes. after initial calibration at manufacturing, the manufacturer or end customer often verifies the energy meter calibration. one convenient way to do this is for the manufacturer to provide an output frequency that is proportional to the active power, reactive power, apparent power, or i rms under steady load conditions. this output frequency can provide a simple single- wire, optically isolated interface to external calibration equipment. figure 79 illustrates the energy-to-frequency conversion in the ADE7116/ade7156/ade7166/ ade7169/ade7566/ade7569. var * va cfxsel[1:0] watt varmscfcon * available only in the ade7569 and ade7169 mode2 register 0x0c i rms cfx pulse output cfxnum cfxden dfc 06353-054 figure 79. energy-to-frequency conversion two digital-to-frequency converters (dfc) are used to generate the pulsed outputs. when wdiv = 0 or 1, the dfc generates a pulse each time 1 lsb in the energy register is accumulated. an output pulse is generated when a cfxnum/cfxden number of pulses is generated at the dfc output. under steady load conditions, the output frequency is proportional to the active power, reactive power, apparent power, or i rms , depending on the cfxsel bits in the mode2 register (address 0x0c). both pulse outputs can be enabled or disabled by clearing or setting the discf1 bit (bit 1) and the discf2 bit (bit 2) in the mode1 register (address 0x0b), respectively. both pulse outputs set separate flags in the interrupt status 2 sfr (mirqstm, address 0xdd): cf1 (bit 6) and cf2 (bit 7). if the cf1 enable bit (bit 6) and cf2 enable bit (bit 7) in the interrupt enable 2 sfr (mirqenm, address 0xda) are set, the 8052 core has a pending ade interrupt. the ade interrupt stays active until the cf1 or cf2 status bit is cleared (see the energy measurement interrupts section). pulse output configuration the two pulse output circuits have separate configuration bits in the mode2 register (address 0x0c). setting the cfxsel bits to 0b00, 0b01, or 0b1x configures the dfc to create a pulse output proportional to active power , reactive power (ade7169/ ade7569 only), or apparent power or i rms , respectively. the selection between i rms and apparent power is done by the varmscfcon bit in the mode2 register (address 0x0c). with this selection, cf2 cannot be proportional to apparent power if cf1 is proportional to i rms , and cf1 cannot be proportional to apparent power if cf2 is proportional to i rms . pulse output characteristic the pulse output for both dfcs stays low for 90 ms if the pulse period is longer than 180 ms (5.56 hz). if the pulse period is shorter than 180 ms, the duty cycle of the pulse output is 50%. the pulse output is active low and should be connected to an led, as shown in figure 80 . v dd cf 0 6353-055 figure 80. cf pulse output the maximum output frequency with ac input signals at full scale and with cfxnum = 0x00 and cfxden = 0x00 is approximately 21.1 khz. the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 incorporate two registers per dfc, cfxnum[15:0] and cfxden[15:0], to set the cfx frequency. these unsigned, 16-bit registers can be used to adjust the cfx frequency to a wide range of values. these frequency scaling registers are 16-bit registers that can scale the output frequency by 1/2 16 to 1 with a step of 1/2 16 .
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 76 of 152 if 0 is written to any of these registers, 1 is applied to the register. the ratio of cfxnum/cfxden should be less than 1 to ensure proper operation. if the ratio of the cfxnum/cfxden registers is greater than 1, the register values are adjusted to a ratio of 1. for example, if the output frequency is 1.562 khz, and the content of cfxden is 0 (0x000), the output frequency can be set to 6.1 hz by writing 0xff to the cfxden register. energy register scaling the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 provide measurements of active, reactive, and apparent energies that use separate paths and filtering for calculation. the difference in data paths can result in small differences in lsb weight between active, reactive, and apparent energy registers. these measurements are internally compensated so that the scaling is nearly one to one. the relationship between these registers is shown in tabl e 47 . table 47. energy registers scaling line frequency = 50 hz line frequency = 60 hz integrator var = 0.9952 watt var = 0.9949 watt off va = 0.9978 watt va = 1.0015 watt off var = 0.9997 watt var = 0.9999 watt on va = 0.9977 watt va = 1.0015 watt on energy measurement interrupts the energy measurement part of the ADE7116/ade7156/ ade7166/ade7169/ade7566/ade7569 has its own interrupt vector for the 8052 core, vector address 0x004b (see the interrupt vectors section). the bits set in the interrupt enable 1 sfr (mirqenl, address 0xd9), interrupt enable 2 sfr (mirqenm, address 0xda), and interrupt enable 3 sfr (mirqenh, address 0xdb) enable the energy measurement interrupts that are allowed to interrupt the 8052 core. if an event is not enabled, it cannot create a system interrupt. the ade interrupt stays active until the status bit that has created the interrupt is cleared. the status bit is cleared when a 0 is written to this register bit.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 77 of 152 temperature, battery, and supply voltage measurements the ade7156/ade7166/ade7169/ade7566/ade7569 include temperature measurements as well as battery and supply voltage measurements. (this feature is not available in the ADE7116.) these measurements enable many forms of compensation. the temperature and supply voltage measurements can be used to compensate external circuitry. the rtc can be calibrated over temperature to ensure that it does not drift. supply voltage measurements allow the lcd contrast to be maintained despite variations in voltage. battery measurements allow low battery detection to be performed. all adc measurements are configured through the sfrs, as shown in tabl e 48 . the temperature, battery, and supply voltage measurements can be configured to continue functioning in psm1 and psm2. keeping the temperature measurement active ensures that it is not necessary to wait for the temperature measurement to settle before using it for compensation. table 48. temperature, battery, and supply voltage measurement sfrs sfr address r/w mnemonic description 0xf9 r/w strbper peripheral adc strobe period (see table 49 ). 0xf3 r/w diffprog temperature and supply delta (see table 50 ). 0xd8 r/w adcgo start adc measurement (see table 51 ). 0xfa r/w batvth battery detection threshold (see table 52 ). 0xef r/w vdcinadc v dcin adc value (see table 53 ). 0xdf r/w batadc battery adc value (see table 54 ). 0xd7 r/w tempadc temperature adc value (see table 55 ). table 49. peripheral adc strobe period sfr (strbper, address 0xf9) bit mnemonic default description [7:6] reserved 00 these bits must be kept at 0 for proper operation. [5:4] vdcin_period 0 period for backgr ound external voltage measurements. vdcin_period result 00 no v dcin measurement 01 8 min 10 2 min 11 1 min [3:2] batt_period 0 period for background battery level measurements. batt_period result 00 no battery measurement 01 16 min 10 4 min 11 1 min [1:0] temp_period 0 period for back ground temperature measurements. temp_period result 00 no temperature measurement 01 8 min 10 2 min 11 1 min
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 78 of 152 table 50. temperature and supply delta sfr (diffprog, address 0xf3) bit mnemonic default description [7:6] reserved 0 reserved. [5:3] temp_diff 0 difference threshold between last temperature measurement interrupting 8052 and new temperature measurement that should interrupt 8052. temp_diff result 000 no interrupt 001 1 lsb ( 0.8c) 010 2 lsb ( 1.6c) 011 3 lsb ( 2.4c) 100 4 lsb ( 3.2c) 101 5 lsb ( 4c) 110 6 lsb ( 4.8c) 111 every temperature measurement [2:0] vdcin_diff 0 difference threshold between last external voltage measurement interrupting 8052 and new external measurement that should interrupt 8052. vdcin_diff result 000 no interrupt 001 1 lsb ( 120 mv) 010 2 lsb ( 240 mv) 011 3 lsb ( 360 mv) 100 4 lsb ( 480 mv) 101 5 lsb ( 600 mv) 110 6 lsb ( 720 mv) 111 every v dcin measurement table 51. start adc measurement sfr (adcgo, address 0xd8) bit address mnemonic default description 7 0xdf pllack 0 set this bit to clear the pll fault bit, pll_flt, in the periph register (address 0xf4). a pll fault is generated if a rese t is caused becaus e the pll lost lock. [6:3] 0xde to 0xdb reserved 0 reserved. 2 0xda vdcin_adc_go 0 set this bit to initiate an external voltage measurement. this bit is cleared when the measurement request is received by the adc. 1 0xd9 temp_adc_go 0 set this bit to initiate a temperature measurement. this bi t is cleared when the measurement request is received by the adc. 0 0xd8 batt_adc_go 0 set this bit to initiate a battery meas urement. this bit is cleared when the measurement request is received by the adc. table 52. battery detection thresh old sfr (batvth, address 0xfa) bit mnemonic default description [7:0] batvth 0 the battery adc value is compared to this register, the battery threshold register. if batadc is lower than the threshol d, an interrupt is generated. table 53. v dcin adc value sfr (vdcinadc, address 0xef) bit mnemonic default description [7:0] vdcinadc 0 the vdcinadc value in this regi ster is updated when an adc interrupt occurs. table 54. battery adc value sfr (batadc, address 0xdf) bit mnemonic default description [7:0] batadc 0 the battery adc value in this register is updated when an adc interrupt occurs. table 55. temperature adc value sfr (tempadc, address 0xd7) bit mnemonic default description [7:0] tempadc 0 the temperature adc value in this re gister is updated when an adc interrupt occurs.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 79 of 152 temperature measurement to provide a digital temperature measurement, each ade7156/ ade7166/ade7169/ade7566/ade7569 includes a dedicated adc. an 8-bit temperature adc value sfr (tempadc, address 0xd7) holds the results of the temperature conversion. the resolution of the temperature measurement is 0.78c/lsb. there are two ways to initiate a temperature conversion: a single temperature measurement or background temperature measurements. single temperature measurement set the temp_adc_go bit (bit 1) in the start adc measure- ment sfr (adcgo, address 0xd8) to obtain a temperature measurement (see table 51 ). an interrupt is generated when the conversion is complete and when the temperature measurement is available in the temperature adc value sfr (tempadc, address 0xd7). background temperature measurements b ackground temperature measurements are disabled by default. to configure the background temperature measurement mode, set a temperature measurement interval in the peripheral adc strobe period sfr (strbper, address 0xf9). temperature measurements are then performed periodically in the background (see tabl e 49 ). wh en a temperature conversion completes, the new temperature adc value is compared to the last temperature adc value that created an interrupt. if the absolute difference between the two values is greater than the setting in the temp_diff bits in the temperature and supply delta sfr (diffprog, address 0xf3), a tempadc interrupt is generated (see table 50 ). this allows temperature measurements to take place completely in the background, requiring mcu activity only if the temperature changes more than a configurable delta. to set up background temperature measurement, 1. initiate a single temperature measurement by setting the temp_adc_go bit in the start adc measurement sfr (adcgo, address 0xd8). 2. upon completion of this measurement, configure the temp_diff bits in the temperature and supply delta sfr (diffprog, address 0xf3) to establish the change in temperature that triggers an interrupt. 3. set up the interval for background temperature measurements by configuring the temp_period[1:0] bits in the periph- eral adc strobe period sfr (strbper, address 0xf9). t emperature adc in psm0, psm1, and psm2 d epending on the operating mode of the ade7156/ade7166/ ade7169/ade7566/ade7569, a temperature conversion is initiated only by certain actions. ? in psm0 operating mode, the 8052 is active. temperature measurements are available in the background measurement mode and by initiating a single measurement. ? in psm1 operating mode, the 8052 is active, and the part is battery powered. single temperature measurements can be initiated by setting the temp_adc_go bit in the start adc measurement sfr (adcgo, address 0xd8). background temperature measurements are not available. ? in psm2 operating mode, the 8052 is not active. temperature conversions are available through the background measurement mode only. t he temperature adc value sfr (tempadc, address 0xd7) is updated with a new value only when a temperature adc interrupt occurs. t emperature adc interrupt the temperature adc can generate an adc interrupt when at least one of the following conditions occurs: ? the difference between the new temperature adc value and the last temperature adc value generating an adc interrupt is larger than the value set in the temp_diff bits. ? the temperature adc conversion, initiated by setting the start adc measurement sfr (adcgo, address 0xd8), finishes. when the adc interrupt occurs, a new value is available in the temperature adc value sfr (tempadc, address 0xd7). note that there is no flag associated with this interrupt. battery measurement to provide a digital battery measurement, each ade7156/ ade7166/ade7169/ade7566/ade7569 includes a dedicated adc. the battery measurement is available in the 8-bit battery adc value sfr (batadc, address 0xdf). the battery measurement has a resolution of 14.6 mv/lsb. a battery conversion can be initiated by two methods: a single battery measurement or background battery measurements. single battery measurement set the batt_adc_go bit (bit 0) in the start adc measurement sfr (adcgo, address 0xd8) to obtain a battery measurement. an interrupt is generated when the conversion is done and when the battery measurement is available in the battery adc value sfr (batadc, address 0xdf). background battery measurements t o configure background measurements for the battery, establish a measurement interval in the peripheral adc strobe period sfr (strbper, address 0xf9). battery measurements are then performed periodically in the background (see table 49 ). wh en a battery conversion completes, the battery adc value is compared to the low battery threshold, established in the battery detection threshold sfr (batvth, address 0xfa). if the battery adc value is below this threshold, a low battery flag is set. this low battery flag is the fbat bit (bit 2) in the power manage- ment interrupt flag sfr (ipsmf, address 0xf8), used for power supply management.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 80 of 152 this low battery flag can be enabled to generate the psm interrupt by setting the ebat bit (bit 2) in the power management interrupt enable sfr (ipsme, address 0xec). this method allows battery measurements to take place completely in the background, requiring mcu activity only if the battery drops below a user-specified threshold. to set up background battery measurements, follow these steps: 1. configure the battery detection threshold sfr (batvth, address 0xfa) to establish a low battery threshold. if the batadc measurement is below this threshold, the fbat bit (bit 2) in the power management interrupt flag sfr (ipsmf, address 0xf8) is set. 2. set up the interval for background battery measurements by configuring the batt_period bits in the peripheral adc strobe period sfr (strbper, address 0xf9). b attery adc in psm0, psm1, and psm2 modes d epending on the operating mode, a battery conversion is initiated only by certain actions. ? in psm0 operating mode, the 8052 is active. battery measurements are available in the background measure- ment mode and by initiating a single measurement. ? in psm1 operating mode, the 8052 is active and the part is battery powered. single battery measurements can be initiated by setting the batt_adc_go bit (bit 0) in the start adc measurement sfr (adcgo, address 0xd8). background battery measurements are not available. ? in psm2 operating mode, the 8052 is not active. unlike temperature and vdcin measurements, the battery conversions are not available in this mode. b attery adc interrupt the battery adc can generate an adc interrupt when at least one of the following conditions occurs: ? the new battery adc value is smaller than the value set in the battery detection threshold sfr (batvth, address 0xfa), indicating a battery voltage loss. ? a single battery measurement initiated by setting the batt_adc_go bit finishes. when the battery flag (fbat, bit 2) is set in the power manage- ment interrupt flag sfr (ipsmf, address 0xf8), a new adc value is available in the battery adc value sfr (batadc, address 0xdf). this battery flag can be enabled as a source of the psm interrupt to generate a psm interrupt every time the battery drops below a set voltage threshold or after a single conversion initiated by setting the batt_adc_go bit is ready. the battery adc value sfr (batadc, address 0xdf) is updated with a new value only when the battery flag (fbat) is set in the power management interrupt flag sfr (ipsmf, address 0xf8). external voltage measurement the ade7156/ade7166/ade7169/ade7566/ade7569 include a dedicated adc to provide a digital measurement of an external voltage on the v dcin pin. an 8-bit sfr, the v dcin adc value sfr (vdcinadc, address 0xef), holds the results of the conversion. the resolution of the external voltage measure- ment is 15.3 mv/lsb. there are two ways to initiate an external voltage conversion: a single external voltage measurement or background external voltage measurements. single external voltage measurement to obtain an external voltage measurement, set the vdcin_adc_go bit (bit 2) in the start adc measurement sfr (adcgo, address 0xd8). an interrupt is generated when the conversion is done and when the external voltage measure- ment is available in the v dcin adc value sfr (vdcinadc, address 0xef). background external voltage measurements background external voltage measurements are disabled by default. to configure the background external voltage measurement mode, set an external voltage measurement interval in the peripheral adc strobe period sfr (strbper, address 0xf9). external voltage measurements are performed periodically in the background (see table 49 ). w hen an external voltage conversion is complete, the new external voltage adc value is compared to the last external voltage adc value that created an interrupt. if the absolute diff- erence between the two values is greater than the setting in the vdcin_diff[2:0] bits in the temperature and supply delta sfr (diffprog, address 0xf3), a v dcin adc flag is set. this v dcin adc flag is fvadc (bit 3) in the power management interrupt flag sfr (ipsmf, address 0xf8), which is used for power supply management. this v dcin adc flag can be enabled to generate a psm interrupt by setting the evadc bit (bit 3) in the power management interrupt enable sfr (ipsme, address 0xec). th is method allows external volt age measurements to take place completely in the background, requiring mcu activity only if the external voltage has changed more than a configurable delta. to set up background external voltage measurements, follow these steps: 1. initiate a single external voltage measurement by setting the vdcin_adc_go bit (bit 2) in the start adc measurement sfr (adcgo, address 0xd8). 2. upon completion of this measurement, configure the vdcin_diff[2:0] bits to establish the change in voltage that sets the fvdcin bit (bit 0) in the power management interrupt flag sfr (ipsmf, address 0xf8). 3. set up the interval for background external voltage measure- ments by configuring the vdcin_period bits in the peripheral adc strobe period sfr (strbper, address 0xf9).
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 81 of 152 e xternal voltage adc in psm0, psm1, and psm2 modes a n external voltage conversion is initiated only by certain actions that depend on the operating mode of the ade7156/ade7166/ ade7169/ade7566/ade7569. ? in psm0 operating mode, the 8052 is active. external voltage measurements are available in the background measurement mode and by initiating a single measurement. ? in psm1 operating mode, the 8052 is active and the part is powered from battery. single external voltage measurements can be initiated by setting the vdcin_adc_go bit (bit 2) in the start adc measurement sfr (adcgo, address 0xd8). background external voltage measurements are not available. ? in psm2 operating mode, the 8052 is not active. external voltage conversions are available through the background measurement mode only. t he external voltage adc in the v dcin adc value sfr (vdcinadc, address 0xef) is updated with a new value only when an external voltage adc interrupt occurs. e xternal voltage adc interrupt the external voltage adc can generate an adc interrupt when at least one of the following conditions occurs: ? the difference between the new external voltage adc value and the last external voltage adc value generating an adc interrupt is larger than the value set in the vdcin_diff[2:0] bits in the temperature and supply delta sfr (diffprog, address 0xf3). ? the external voltage adc conversion initiated by setting vdcin_adc_go, finishes. when the adc interrupt occurs, a new value is available in the v dcin adc value sfr (vdcinadc, address 0xef). note that there is no flag associated with this interrupt.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 82 of 152 8052 mcu core architecture the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 have an 8052 mcu core and use the 8052 instruction set. some of the standard 8052 peripherals, such as the uart, have been enhanced. this section describes the standard 8052 core and enhancements that have been made to it in the ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569. the special function register (sfr) space is mapped into the upper 128 bytes of internal data memory space and is accessed by direct addressing only. it provides an interface between the cpu and all on-chip peripherals. see figure 81 for a block diagram of the programming model for the ADE7116/ade7156/ade7166/ ade7169/ade7566/ade7569 via the sfr area. all registers except the program counter (pc), instruction register (ir), and the four general-purpose register banks reside in the sfr area. the sfr registers include control, configuration, and data registers that provide an interface between the cpu and all on-chip peripherals. energy measurement pc 16kb electrically reprogrammable nonvolatile flash/ee program/data memory 8052 compatible core 256 bytes xram other on-chip peripherals: ? serial i/o ? wdt ? timers battery adc lcd driver temperature adc rtc power management 128-byte special function register area ir stack 256 bytes general- purpose ram register banks 06353-056 figure 81. block diagram showing programming model via the sfrs mcu registers the registers used by the mcu are summarized in this section. table 56. 8052 sfrs sfr address bit addressable description acc 0xe0 yes accumulator. b 0xf0 yes auxiliary math. psw 0xd0 yes program status word (see table 57 ). pcon 0x87 no program control (see table 58 ). dpl 0x82 no data pointer low (see table 59 ). dph 0x83 no data pointer high (see table 60 ). dptr 0x82 and 0x83 no data pointer (see table 61 ). sp 0x81 no stack pointer (see table 62 ). cfg 0xaf no configuration (see table 63 ). table 57. program status word sfr (psw, address 0xd0) bit bit address mnemonic description 7 0xd7 cy carry flag. modified by add, addc, subb, mul, and div instructions. 6 0xd6 ac auxiliary carry flag. modified by add and addc instructions. 5 0xd5 f0 general-purpose flag available to the user. [4:3] 0xd4, 0xd3 rs1, rs0 register bank select bits. rs1 rs0 selected bank 0 0 0 0 1 1 1 0 2 1 1 3 2 0xd2 ov overflow flag. modified by ad d, addc, subb, mul, and div instructions. 1 0xd1 f1 general-purpose flag available to the user. 0 0xd0 p parity bit. the number of bits set in the accu mulator added to the value of the parity bit is always an even number.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 83 of 152 table 58. program control sfr (pcon, address 0x87) bit mnemonic default description 7 smod 0 double baud rate control. [6:0] reserved 0 reserved. these bits must be kept at 0 for proper operation. table 59. data pointer low sfr (dpl, address 0x82) bit mnemonic default description [7:0] dpl 0 these bits contain the low byte of the data pointer. table 60. data pointer high sfr (dph, address 0x83) bit mnemonic default description [7:0] dph 0 these bits contain the high byte of the data pointer. table 61. data pointer sfr (dptr, address 0x82 and address 0x83) bit mnemonic default description [15:0] dp 0 these bits contain the 2-byte address of the data pointer. dptr is a combination of the dph and dpl sfrs. table 62. stack pointer sfr (sp, address 0x81) bit mnemonic default description [7:0] sp 7 these bits contain the eight lsbs of the pointer for the stack. table 63. configuration sfr (cfg, address 0xaf) bit mnemonic default description 7 reserved 1 reserved. this bit should be left set for proper operation. 6 exten 0 enhanced uart enable bit. exten result 0 standard 8052 uart without enhanced error-checking features. 1 enhanced uart with enhanced error checking (see the uart additional features section). 5 scps 0 synchronous communication selection bit. scps result 0 i 2 c port is selected for control of the shared i 2 c/spi pins and sfrs. 1 spi port is selected for control of the shared i 2 c/spi pins and sfrs. 4 mod38en 0 38 khz modulation enable bit. mod38en result 0 38 khz modulation is disabled. 1 38 khz modulation is enabled on the pins selected by the mod38[7:0] bits in the extended port configuration sfr (epcfg, address 0x9f). [3:2] reserved 00 reserved. these bits should be kept at 0 for proper operation. [1:0] xren1, xren0 01 xren[1:0] result xren1 or xren0 = 1 enable movx instruct ion to use 256 bytes of extended ram. xren1 and xren0 = 0 disable movx instruction.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 84 of 152 basic 8052 registers program counter (pc) the program counter holds the 2-byte address of the next instruction to be fetched. the pc is initialized with 0x00 at reset and is incremented after each instruction is performed. note that the amount that is added to the pc depends on the number of bytes in the instruction, therefore, the increment can range from one to three bytes. the program counter is not directly accessible to the user but can be directly modified by call and jmp instructions that change which part of the program is active. instruction register (ir) the instruction register holds the opcode of the instruction being executed. the opcode is the binary code that results from assembling an instruction. this register is not directly accessible to the user. register banks there are four banks, each containing an 8-byte-wide register, for a total of 32 bytes of registers. these registers are convenient for temporary storage of mathematical operands. an instruction involving the accumulator and a register can be executed in one clock cycle, as opposed to two clock cycles to perform an instruction involving the accumulator and a literal or a byte of general-purpose ram. the register banks are located in the first 32 bytes of ram. the active register bank is selected by the rs0 and rs1 bits in the program status word sfr (psw, address 0xd0). accumulator the accumulator is a working register, storing the results of many arithmetic or logical operations. the accumulator is used in more than half of the 8052 instructions where it is usually referred to as a. the program status register (psw) constantly monitors the number of bits that are set in the accumulator to determine if it has even or odd parity. the accumulator is stored in the sfr space (see tabl e 56 ). b register the b register is used by the multiply and divide instructions, mul ab and div ab to hold one of the operands. because it is not used for many instructions, it can be used as a scratch pad register like those in the register banks. the b register is stored in the sfr space (see tabl e 56 ). program status word (psw) the psw register (psw, address 0xd0) reflects the status of arithmetic and logical operations through carry, auxiliary carry, and overflow flags. the parity flag reflects the parity of the contents of the accumulator, which can be helpful for communication protocols. the program status word sfr is bit addressable. data pointer (dptr) the data pointer sfr (dptr, address 0x82 and address 0x83) is made up of two 8-bit registers: dpl (low byte, address 0x82), and dph (high byte, address 0x83). these sfrs provide memory addresses for internal code and data access. the dptr can be manipulated as a 16-bit register (dptr = dph, dpl) or as two independent 8-bit registers (dph and dpl) (see tabl e 59 and table 60 ). the 8052 mcu core architecture supports dual data pointers (see the 8052 mcu core architecture section). stack pointer (sp) the stack pointer sfr (sp, address 0x81) keeps track of the current address of the top of the stack. to push a byte of data onto the stack, the stack pointer is incremented and the data is moved to the new top of the stack. to pop a byte of data off the stack, the top byte of data is moved into the awaiting address and the stack pointer is decremented. the stack is a last in, first out (lifo) method of data storage because the most recent addition to the stack is the first to come off it. the stack is used during call and ret instructions to keep track of the address to move into the pc when returning from the function call. the stack is also manipulated when vectoring for interrupts to keep track of the prior state of the pc. the stack resides in the internal extended ram, and the sp register holds the address of the stack in the extended ram. the advantage of this solution is that the stack is segregated to the internal xram. the use of the general-purpose ram can be limited to data storage. the use of the extended internal ram can be limited to the stack pointer. this separation limits the chance of data ram corruption when the stack pointer overflows in data ram. data can still be stored in xram by using the movx command. 0x00 0xff 0xff 0x00 256 bytes of on-chip xram data + stack 256 bytes of ram (data) 0 6353-057 figure 82. extended stack pointer operation to change the default starting address for the stack, move a value into the stack pointer (sp). for example, to enable the extended stack pointer and initialize it at the beginning of the xram space, use the following code: mov sp,#00h
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 85 of 152 standard 8052 sfrs the standard 8052 sfrs include the accumulator (acc), b, psw, dptr, and sp sfrs, as described in the basic 8052 registers section. the 8052 also defines standard timers, serial port interfaces, interrupts, i/o ports, and power-down modes. timer sfrs the 8052 contains three 16-bit timers: the identical timer 0 and timer 1, as well as a timer 2. these timers can also function as event counters. timer 2 has a capture feature in which the value of the timer can be captured in two 8-bit registers upon the assertion of an external input signal (see table 112 and the timers section). serial port sfrs the full-duplex serial port peripheral requires two registers, one for setting up the baud rate and other communication parameters, and another byte for the transmit/receive buffer. the ADE7116/ ade7156/ade7166/ade7169/ade7566/ade7569 also provide enhanced serial port functionality with a dedicated timer for baud rate generation with a fractional divisor and additional error detection. see table 139 and the uart serial interface section. interrupt sfrs there is a two-tiered interrupt system standard in the 8052 core. the priority level for each interrupt source is individually selectable as high or low. the ADE7116/ade7156/ade7166/ ade7169/ade7566/ade7569 enhance this interrupt system by creating, in essence, a third interrupt tier for a highest priority power supply management interrupt (psm). see the interrupt system section. i/o port sfrs the 8052 core supports four i/o ports, p0 through p3, where port 0 and port 2 are typically used for access to external code and data spaces. the ADE7116/ade7156/ade7166/ade7169/ ade7566/ade7569, unlike standard 8052 products, provide internal nonvolatile flash memory so that an external code space is unnecessary. the on-chip lcd driver requires many pins, some of which are dedicated to lcd functionality, and others that can be configured as lcd or general-purpose i/o. due to the limited number of i/o pins, the ADE7116/ade7156/ade7166/ ade7169/ade7566/ade7569 do not allow access to external code and data spaces. the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 provide 20 pins that can be used for general-purpose i/o. these pins are mapped to port 0, port 1, and port 2 and are accessed through three bit-addressable 8052 sfrs: p0, p1, and p2. another enhanced feature of these parts is that the weak pull-ups standard on 8052 port 1, port 2, and port 3 can be disabled to make open-drain outputs, as is standard on port 0. the weak pull-ups can be enabled on a pin-by-pin basis. see the i/o ports section. p ower control register (pcon, address 0x87) t he 8052 core defines two power-down modes: power-down and idle. the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 enhance the power control capability of the traditional 8052 mcu with additional power management functions. the powcon register is used to define power control-specific functionality for the ADE7116/ade7156/ade 7166/ade7169/ ade7566/ade7569. the program control sfr (pcon, address 0x87) is not bit addressable. see the power management section. t he ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 have many other peripherals not standard to the 8052 core: ? ade energy measurement dsp ? rtc ? lcd driver ? battery switchover/power management ? temperature adc ? battery adc ? spi/i 2 c communication ? flash memory controller ? watc hdo g t i mer m emory overview t he ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 contain three memory blocks: ? 16 kb of on-chip flash/ee program and data memory ? 256 bytes of general-purpose ram ? 256 bytes of internal extended ram (xram) the 256 bytes of general-purpose ram share the upper 128 bytes of its address space with the sfrs. all of the memory spaces are shown in figure 81 . the addressing mode specifies which memory space to access. general-purpose ram general-purpose ram resides in memory location 0x00 through memory location 0xff. it contains the register banks. 11 10 01 00 reset value of stack pointer four banks of eight registers r0 to r7 bit-addressable (bit addresses) general-purpose area banks selected via bits in psw 0x 00 0x08 0x10 0x18 0x20 0x30 0x07 0x0f 0x17 0x1f 0x2f 0x7f 0 6353-058 figure 83. lower 128 bytes of internal data memory
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 86 of 152 address 0x80 through address 0xff of general-purpose ram are shared with the sfrs. the mode of addressing determines which memory space is accessed, as shown in figure 84 . general-purpose ram special function registers (sfrs) accessible by indirect addressing only accessible by direct and indirect addressing accessible by direct addressing only 0xff 0x80 0x7f 0x00 06353-059 figure 84. general-purpose ram and sfr memory address overlap both direct and indirect addressing can be used to access general- purpose ram from 0x00 through 0x7f, but indirect addressing must be used to access general-purpose ram with addresses in the range from 0x80 through 0xff because they share the same address space with the sfrs. the 8052 core also has the means to access individual bits of certain addresses in the general-purpose ram and special function memory spaces. the individual bits of general-purpose ram, address 0x20 to address 0x2f, can be accessed through bit address 0x00 to bit address 0x7f. the benefit of bit addressing is that the individual bits can be accessed quickly, without the need for bit masking, which takes more code memory and execution time. the bit addresses for general-purpose ram address 0x20 through address 0x2f can be seen in figure 85 . byte a ddress bit addresses (hexa) 0x2f 0x2e 0x2d 0x2c 0x2b 0x2a 0x29 0 x28 0 x27 0x26 0x25 0x24 0x23 0x22 0x21 0x20 7f 77 6f 67 5f 57 4f 47 3f 37 2f 27 1f 17 0f 07 7e 76 6e 66 5e 56 4e 46 3e 36 2e 26 1e 16 0e 06 7d 75 6d 65 5d 55 4d 45 3d 35 2d 25 1d 15 0d 05 7c 74 6c 64 5c 54 4c 44 3c 34 2c 24 1c 14 0c 04 7b 73 6b 63 5b 53 4b 43 3b 33 2b 23 1b 13 0b 03 7a 72 6a 62 5a 52 4a 42 3a 32 2a 22 1a 12 0a 02 79 71 69 61 59 51 49 41 39 31 29 21 19 11 09 01 78 70 68 60 58 50 48 40 38 30 28 20 18 10 08 00 06353-060 figure 85. bit addressable area of general-purpose ram bit addressing can be used for instructions that involve boolean variable manipulation and program branching (see the instruction set section). special function registers (sfrs) special function registers are registers that affect the function of the 8052 core or its peripherals. these registers are located in ram at address 0x80 through address 0xff. they are accessible only through direct addressing as shown in figure 84 . the individual bits of some of the sfrs can be accessed for use in boolean and program branching instructions. these sfrs are labeled as bit-addressable and the bit addresses are given in table 15 . extended internal ram (xram) the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 provide 256 bytes of extended on-chip ram. no external ram is supported. this ram is located in address 0x00 through address 0xff in the extended ram space. to select the extended ram memory space, the extended indirect addressing modes are used. 256 bytes of extended internal ram (xram) 0x00f f 0x0000 06353-061 figure 86. extended internal ram (xram) space code memory code and data memory is stored in the 16 kb flash memory space. no external code memory is supported. to access code memory, code indirect addressing is used. addressing modes the 8052 core provides several addressing modes. the addressing mode determines how the core interprets the memory location or data value specified in assembly language code. there are six addressing modes, as shown in table 64 . table 64. 8052 addressing modes addressing mode example bytes core clock cycles immediate mov a,#a8h 2 2 mov dptr,#a8h 3 3 direct mov a, a8h 2 2 mov a, ie 2 2 mov a, r0 1 1 indirect mov a, @r0 1 2 extended direct movx a, @dptr 1 4 extended indirect movx a, @r0 1 4 code indirect movc a, @a+dptr 1 4 movc a, @a+pc 1 4 jmp @a+ dptr 1 3
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 87 of 152 immediate addressing in immediate addressing, the expression entered after the number sign (#) is evaluated by the assembler and stored in the memory address specified. this number is referred to as a literal because it refers only to a value and not to a memory location. instructions using this addressing mode are slower than those between two registers because the literal must be stored and fetched from memory. the expression can be entered as a symbolic variable or as an arithmetic expression; the value is computed by the assembler. direct addressing with direct addressing, the value at the source address is moved to the destination address. direct addressing provides the fastest execution time of all the addressing modes when an instruction is performed between registers. note that indirect or direct addressing modes can be used to access general-purpose ram address 0x00 through address 0x7f. an instruction with direct addressing that uses an address between 0x80 and 0xff refers to a special function memory location. indirect addressing with indirect addressing, the value pointed to by the register is moved to the destination address. for example, to move the contents of internal ram address 0x82 to the accumulator, use the following two instructions, which require a total of four clock cycles and three bytes of storage in the program memory: mov r0,#82h mov a,@r0 indirect addressing allows addresses to be computed and is useful for indexing into data arrays stored in ram. note that an instruction that refers to address 0x00 through address 0x7f is referring to internal ram, and indirect or direct addressing mode can be used. an instruction with indirect addressing that uses an address between 0x80 and 0xff refers to internal ram, not to an sfr. extended direct addressing the dptr register (see table 61 ) is used to access internal extended ram in extended indirect addressing mode. the ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 have 256 bytes of xram, accessed through movx instructions. external memory spaces are not supported on this device. in extended direct addressing mode, the dptr register points to the address of the byte of extended ram. the following code moves the contents of extended ram address 0x100 to the accumulator: mov dptr,#100h movx a,@dptr these two instructions require a total of seven clock cycles and four bytes of storage in the program memory. extended indirect addressing the internal extended ram is accessed through a pointer to the address in indirect addressing mode. the ADE7116/ade7156/ ade7166/ade7169/ade7566/ade7569 have 256 bytes of internal extended ram, accessed through movx instructions. external memory is not supported on the devices. in extended indirect addressing mode, a register holds the address of the byte of extended ram. the following code moves the contents of extended ram address 0x80 to the accumulator: mov r0,#80h movx a,@r0 these two instructions require six clock cycles and three bytes of storage. note that there are 256 bytes of extended ram, so both extended direct and extended indirect addressing can cover the whole address range. there is a storage and speed advantage to using extended indirect addressing because the additional byte of addressing available through the dptr register that is not needed is not stored. from the three examples demonstrating the access of internal ram from 0x80 through 0xff and extended internal ram from 0x00 through 0xff, it can be seen that it is most efficient to use the entire internal ram accessible through indirect access before moving to extended ram. code indirect addressing the internal code memory can be accessed indirectly. this can be useful for implementing lookup tables and other arrays of constants that are stored in flash memory. for example, to move the data stored in flash memory at address 0x8002 into the accumulator, use the following code: mov dptr,#8002h clr a movx a,@a+dptr the accumulator can be used as a variable index into the array of flash memory located at dptr.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 88 of 152 instruction set table 65 documents the number of clock cycles required for each instruction. most instructions are executed in one or two clock cycles, resulting in a 4-mips peak performance. note that throughout this section, a represents the accumulator. table 65. instruction set mnemonic description bytes cycles arithmetic add a,rn add register to a 1 1 add a,@ri add indirect memory to a 1 2 add a,dir add direct byte to a 2 2 add a,#data add immediate to a 2 2 addc a,rn add register to a with carry 1 1 addc a,@ri add indirect memory to a with carry 1 2 addc a,dir add direct byte to a with carry 2 2 addc a,#data add immediate to a with carry 2 2 subb a,rn subtract register from a with borrow 1 1 subb a,@ri subtract indirect memory from a with borrow 1 2 subb a,dir subtract direct from a with borrow 2 2 subb a,#data subtract immediate from a with borrow 2 2 inc a increment a 1 1 inc rn increment register 1 1 inc @ ri increment indirect memory 1 2 inc dir increment direct byte 2 2 inc dptr increment data pointer 1 3 dec a decrement a 1 1 dec rn decrement register 1 1 dec @ri decrement indirect memory 1 2 dec dir decrement direct byte 2 2 mul ab multiply a by b 1 9 div ab divide a by b 1 9 da a a decimal adjust a 1 2 logic anl a,rn and register to a 1 1 anl a,@ri and indirect memory to a 1 2 anl a,dir and direct byte to a 2 2 anl a,#data and immediate to a 2 2 anl dir,a and a to direct byte 2 2 anl dir,#data and immediate data to direct byte 3 3 orl a,rn or register to a 1 1 orl a,@ri or indirect memory to a 1 2 orl a,dir or direct byte to a 2 2 orl a,#data or immediate to a 2 2 orl dir,a or a to direct byte 2 2 orl dir,#data or immediate data to direct byte 3 3 xrl a,rn exclusive-or register to a 1 1 xrl a,@ri exclusive-or indirect memory to a 2 2 xrl a,#data exclusive-or immediate to a 2 2 xrl dir,a exclusive-or a to direct byte 2 2 xrl a,dir exclusive-or indirect memory to a 2 2 xrl dir,#data exclusive-or immediate data to direct 3 3 clr a clear a 1 1 cpl a complement a 1 1 swap a swap nibbles of a 1 1 rl a rotate a left 1 1
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 89 of 152 mnemonic description bytes cycles rlc a rotate a left through carry 1 1 rr a rotate a right 1 1 rrc a rotate a right through carry 1 1 data transfer mov a,rn move register to a 1 1 mov a,@ri move indirect memory to a 1 2 mov rn,a move a to register 1 1 mov @ri,a move a to indirect memory 1 2 mov a,dir move direct byte to a 2 2 mov a,#data move immediate to a 2 2 mov rn,#data move register to immediate 2 2 mov dir,a move a to direct byte 2 2 mov rn,dir move register to direct byte 2 2 mov dir,rn move direct to register 2 2 mov @ri,#data move immediate to indirect memory 2 2 mov dir,@ri move indirect to direct memory 2 2 mov @ri,dir move direct to indirect memory 2 2 mov dir,dir move direct byte to direct byte 3 3 mov dir,#data move immediate to direct byte 3 3 mov dptr,#data move immediate to data pointer 3 3 movc a,@a+dptr move code byte relative dptr to a 1 4 movc a,@a+pc move code byte relative pc to a 1 4 movx a,@ri move external (a8) data to a 1 4 movx a,@dptr move external (a16) data to a 1 4 movx @ri,a move a to external data (a8) 1 4 movx @dptr,a move a to external data (a16) 1 4 push dir push direct byte onto stack 2 2 pop dir pop direct byte from stack 2 2 xch a,rn exchange a and register 1 1 xch a,@ri exchange a and indirect memory 1 2 xchd a,@ri exchange a and indirect memory nibble 1 2 xch a,dir exchange a and direct byte 2 2 boolean clr c clear carry 1 1 clr bit clear direct bit 2 2 setb c set carry 1 1 setb bit set direct bit 2 2 cpl c complement carry 1 1 cpl bit complement direct bit 2 2 anl c,bit and direct bit and carry 2 2 anl c,/bit and direct bit inverse to carry 2 2 orl c,bit or direct bit and carry 2 2 orl c,/bit or direct bit inverse to carry 2 2 mov c,bit move direct bit to carry 2 2 mov bit,c move carry to direct bit 2 2 branching jmp @a+dptr jump indirect relative to dptr 1 3 ret return from subroutine 1 4 reti return from interrupt 1 4 acall addr11 absolute jump to subroutine 2 3 ajmp addr11 absolute jump unconditional 2 3 sjmp rel short jump (relative address) 2 3 jc rel jump on carry equal to 1 2 3
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 90 of 152 mnemonic description bytes cycles jnc rel jump on carry equal to 0 2 3 jz rel jump on accumulator = 0 2 3 jnz rel jump on accumulator 0 2 3 djnz rn,rel decrement register, jnz relative 2 3 ljmp long jump unconditional 3 4 lcall addr16 long jump to subroutine 3 4 jb bit,rel jump on direct bit = 1 3 4 jnb bit,rel jump on direct bit = 0 3 4 jbc bit,rel jump on direct bit = 1 and clear 3 4 cjne a,dir,rel compare a, direct jne relative 3 4 cjne a,#data,rel compare a, immediate jne relative 3 4 cjne rn,#data,rel compare register, immediate jne relative 3 4 cjne @ri,#data,rel compare indirect, immediate jne relative 3 4 djnz dir,rel decrement direct byte, jnz relative 3 4 miscellaneous nop no operation 1 1 read-modify-write instructions some 8052 instructions read the latch and others read the pin. the state of the pin is read for instructions that input a port bit. instructions that read the latch rather than the pins are the ones that read a value, possibly change it, and rewrite it to the latch. because these instructions involve modifying the port, it is assumed that the pins being modified are outputs, so the output state of the pin is read from the latch. this prevents a possible misinterpretation of the voltage level of a pin. for example, if a port pin is used to drive the base of a transistor, a 1 is written to the bit to turn on the transistor. if the cpu reads the same port bit at the pin rather than the latch, it reads the base voltage of the transistor and interprets it as logic 0. reading the latch rather than the pin returns the correct value of 1. the instructions that read the latch rather than the pins are called read-modify-write instructions and are listed in table 66 . when the destination operand is a port or a port bit, these instructions read the latch rather than the pin. table 66. read-modify-write instructions instruction example description anl anl p0,a logic and orl orl p1,a logic or xrl xrl p2,a logic ex-or jbc jbc p1.1,label jump if bit = 1 and clear bit cpl cpl p2.0 complement bit inc inc p2 increment dec dec p2 decrement djnz djnz p0,label decrement and jump if not zero mov px.y,c 1 mov p0.0,c move carry to bit y of port x clr px.y 1 clr p0.0 clear bit y of port x setb px.y 1 setb p0.0 set bit y of port x 1 these instructions read the port byte (all eight bits), modify the addressed bit, and write the new byte back to the latch. instructions that affect flags many instructions explicitly modify the carry bit, such as the mov c bit and clr c instructions. other instructions that affect status flags are listed in this section. add a, source this instruction adds the source to the accumulator. no status flags are referenced by the instruction. table 67. add a (source) affected status flags flag description c set if there is a carry out of bit 7. cleared otherwise. used to indicate an overflow if the operands are unsigned. ov set if there is a carry out of bit 6 or a carry out of bit 7, but not if both are set. used to indicate an overflow for signed addition. this flag is set if two positive operands yield a negative result or if two negative operands yield a positive result. ac set if there is a carry out of bit 3. cleared otherwise. addc a, source this instruction adds the source and the carry bit to the accu- mulator. the carry status flag is referenced by the instruction. table 68. addc a (source) affected flags flag description c set if there is a carry out of bit 7. cleared otherwise. used to indicate an overflow if the operands are unsigned. ov set if there is a carry out of bit 6 or a carry out of bit 7, but not if both are set. used to indicate an overflow for signed addition. this flag is set if two positive operands yield a negative result or if two negative operands yield a positive result. ac set if there is a carry out of bit 3. cleared otherwise.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 91 of 152 subb a, source this instruction subtracts the source byte and the carry (borrow) flag from the accumulator. it references the carry (borrow) status flag. table 69. subb a (source) affected status flags flag description c set if there is a borrow needed for bit 7. cleared otherwise. used to indicate an overflow if the operands are unsigned. ov set if there is a borrow needed for bit 6 or bit 7, but not for both. used to indicate an overflow for signed subtraction. this flag is set if a negative number subtracted from a positive number yields a negative result or if a positive number subtracted from a negative number yields a positive result. ac set if a borrow is needed for bit 3. cleared otherwise. mul ab this instruction multiplies the accumulator by the b sfr. this operation is unsigned. the lower byte of the 16-bit product is stored in the accumulator and the higher byte is left in the b register. no status flags are referenced by the instruction. table 70. mul ab affected status flags flag description c cleared ov set if the result is greater than 255. cleared otherwise. div ab this instruction divides the accumulator by the b sfr. this operation is unsigned. the integer part of the quotient is stored in the accumulator and the remainder goes into the b register. no status flags are referenced by the instruction. table 71. div ab affected status flags flag description c cleared ov cleared unless the b register is equal to 0, in which case the results of the division are undefined and the ov flag is set. da a this instruction adjusts the accumulator to hold two 4-bit digits after the addition of two binary coded decimals (bcds) with the add or addc instructions. if the ac bit is set or if the value of bit 0 to bit 3 exceeds 9, 0x06 is added to the accumulator to correct the lower four bits. if the carry bit is set when the instruction begins, or if 0x06 is added to the accumulator in the first step, 0x60 is added to the accumulator to correct the higher four bits. the carry and ac status flags are referenced by this instruction. table 72. da a affected status flag flag description c set if the result is greater than 0x99. cleared otherwise. rrc a this instruction rotates the accumulator to the right through the carry flag. the old lsb of the accumulator becomes the new carry flag, and the old carry flag is loaded into the new msb of the accumulator. the carry status flag is referenced by this instruction. table 73. rrc a affected status flag flag description c equal to the state of acc[0] before execution of the instruction. rlc a this instruction rotates the accumulator to the left through the carry flag. the old msb of the accumulator becomes the new carry flag, and the old carry flag is loaded into the new lsb of the accumulator. the carry status flag is referenced by this instruction. table 74. rlc a affected status flag flag description c equal to the state of acc[7] before execution of the instruction. cjne destination, source, relative jump this instruction compares the source value to the destination value and branches to the location set by the relative jump if they are not equal. if the values are equal, program execution continues with the instruction after the cjne instruction. no status flags are referenced by this instruction. table 75. cjne destination (sou rce, relative jump) affected status flags flag description c set if the source value is greater than the destination value. cleared otherwise.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 92 of 152 dual data pointers each ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 incorporates two data pointers. the second data pointer is a shadow data pointer and is selected via the data pointer control sfr (dpcon, address 0xa7). dpcon features automatic hardware postincrement and postdecrement, as well as an automatic data pointer toggle. note that this is the only section of the data sheet where the main and shadow data pointers are distinguished. whenever the data pointer (dptr) is mentioned elsewhere in the data sheet, active dptr is implied. in addition, only the movc/movx @dptr instructions automatically postincrement and postdecrement the dptr. other movc/movx instructions, such as movc pc or movc @ri, do not cause the dptr to automatically postincrement and postdecrement. to illustrate the operation of dpcon, the following code copies 256 bytes of code memory at address 0xd000 into xram, starting from address 0x0000: mov dptr,#0 ;main dptr = 0 mov dpcon,#55h ;select shadow dptr ;dptr1 increment mode ;dptr0 increment mode ;dptr auto toggling on mov dptr,#0d000h ;dptr = d000h moveloop: clr a movc a,@a+dptr ;get data ;post inc dptr ;swap to main dptr(data) movx @dptr,a ;put acc in xram ;increment main dptr ;swap shadow dptr(code) mov a, dpl jnz moveloop table 76. data pointer control sfr (dpcon, address 0xa7) bit mnemonic default description 7 0 not implemented. write dont care. 6 dpt 0 data pointer automatic toggle enable. cleared by th e user to disable autoswapping of the dptr. set in user software to enable automatic toggling of the dptr after each movx or movc instruction. [5:4] dp1m1, dp1m0 0 shadow data pointer mode. these bits enable extra modes of the shadow data pointer operation, allowing more compact and more e fficient code size and execution. dp1m1 dp1m0 result (behavior of the shadow data pointer) 0 0 8052 behavior. 0 1 dptr is postincremented afte r a movx or a movc instruction. 1 0 dptr is postdecremented af ter a movx or movc instruction. 1 1 dptr lsb is toggled after a movx or movc instruction. this instruction can be useful for moving 8-bit blocks to/from 16-bit devices. [3:2] dp0m1, dp0m0 0 main data pointer mode. these bits enable extra modes of the main data pointer operation, allowing more compact and more effici ent code size and execution. dp0m1 dp0m0 result (behavior of the main data pointer) 0 0 8052 behavior. 0 1 dptr is postincremented afte r a movx or a movc instruction. 1 0 dptr is postdecremented af ter a movx or movc instruction. 1 1 dptr lsb is toggled after a movx or movc instruction. this instruction is useful for moving 8-bit blocks to/from 16-bit devices. 1 0 not implemented. write dont care. 0 dpsel 0 data pointer select. cleared by the user to select th e main data pointer, meaning that the contents of this 16-bit register are placed into the dpl sfr and d ph sfr. set by the user to select the shadow data pointer, meaning that the contents of a separate 16- bit register appear in the dpl sfr and dph sfr.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 93 of 152 interrupt system the unique power management architecture of the ADE7116/ ade7156/ade7166/ade7169/ade7566/ade7569 includes an operating mode (psm2) where the 8052 mcu core is shut down. events can be configured to wake the 8052 mcu core from the psm2 operating mode. a distinction is drawn here between events that can trigger the wake-up of the 8052 mcu core and events that can trigger an interrupt when the mcu core is active. events that can wake the core are referred to as wake-up events, whereas events that can interrupt the program flow when the mcu is active are called interrupts. see the 3.3 v peripherals and wake-up events section to learn more about events that can wake the 8052 core from psm2 mode. the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 provide 12 interrupt sources with three priority levels. the power management interrupt is at the highest priority level. the other two priority levels are configurable through the interrupt priority sfr (ip, address 0xb8) and the interrupt enable and priority 2 sfr (ieip2, address 0xa9). standard 8052 interrupt architecture the standard 8052 interrupt architecture includes two tiers of interrupts, where some interrupts are assigned a high priority and others are assigned a low priority. priority 1 priority 0 high low 06353-062 figure 87. standard 8052 interrupt priority levels a priority 1 interrupt can interrupt the service routine of a priority 0 interrupt, and if two interrupts of different priorities occur at the same time, the priority 1 interrupt is serviced first. an interrupt cannot be interrupted by another interrupt of the same priority level. if two interrupts of the same priority level occur simultaneously, a polling sequence is observed. see the interrupt priority section. interrupt architecture the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 possess advanced power supply management features. to ensure a fast response to time-critical power supply issues, such as a loss of line power, the power supply manage- ment interrupt should be able to interrupt any interrupt service routine. to enable the user to have full use of the standard 8052 interrupt priority levels, an additional priority level is added for the power supply management (psm) interrupt. the psm interrupt is the only interrupt at this highest interrupt priority level. priority 1 priority 0 psm high low 0 6353-063 figure 88. interrupt architecture see the power supply management (psm) interrupt section for more information on the psm interrupt. interrupt registers the control and configuration of the interrupt system are carried out through four interrupt-related sfrs, discussed in this section. table 77. interrupt sfrs sfr address default bit addressable description ie 0xa8 0x00 yes interrupt enable (see table 78 ). ip 0xb8 0x00 yes interrupt priority (see table 79 ). ieip2 0xa9 0xa0 no interrup t enable and priority 2 (see table 80 ). wdcon 0xc0 0x10 yes watchdog timer (see table 85 and the writing to the watchdog timer sfr (wdcon, address 0xc0) section). table 78. interrupt enable sfr (ie, address 0xa8) bit bit address mnemonic description 7 0xaf ea enables all interrupt sources. set by the user. cleared by the user to disa ble all interrupt sources. 6 0xae etemp 1 enables the temperature adc in terrupt. set by the user. 5 0xad et2 enables the timer 2 interrupt. set by the user. 4 0xac es enables the uart serial port interrupt. set by the user. 3 0xab et1 enables the timer 1 interrupt. set by the user. 2 0xaa ex1 enables external interrupt 1 ( int1 ). set by the user. 1 0xa9 et0 enables the timer 0 interrupt. set by the user. 0 0xa8 ex0 enables external interrupt 0 ( int0 ). set by the user. 1 this feature is not av ailable in the ADE7116.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 94 of 152 table 79. interrupt priority sfr (ip, address 0xb8) bit bit address mnemonic description 7 0xbf pade ade energy measurement interrupt priority (1 = high, 0 = low). 6 0xbe ptemp temperature adc interrupt priority (1 = high, 0 = low). 5 0xbd pt2 timer 2 interrupt priority (1 = high, 0 = low). 4 0xbc ps uart serial port interrupt priority (1 = high, 0 = low). 3 0xbb pt1 timer 1 interrupt priority (1 = high, 0 = low). 2 0xba px1 int1 (external interrupt 1) priority (1 = high, 0 = low). 1 0xb9 pt0 timer 0 interrupt priority (1 = high, 0 = low). 0 0xb8 px0 int0 (external interrupt 0) priority (1 = high, 0 = low). table 80. interrupt enable and priority 2 sfr (ieip2, address 0xa9) bit mnemonic description 7 reserved 6 pti rtc interrupt priority (1 = high, 0 = low). 5 reserved 4 psi spi/i 2 c interrupt priority (1 = high, 0 = low). 3 eade enables the energy metering interrupt (ade). set by the user. 2 eti enables the rtc interval t imer interrupt. set by the user. 1 epsm enables the psm power supply mana gement interrupt. set by the user. 0 esi enables the spi/i 2 c interrupt. set by the user. interrupt priority if two interrupts of the same priority level occur simultaneously, the polling sequence is observed (as shown in table 81 ). table 81. priority within interrupt level source priority description ipsm 0 (highest) power supply monitor interrupt. irtc 1 rtc interval timer interrupt. iade 2 ade energy measurement interrupt. wdt 3 watchdog timer overflow interrupt. itemp 1 4 temperature adc interrupt ie0 5 external interrupt 0. tf0 6 timer/counter 0 interrupt. ie1 7 external interrupt 1. tf1 8 timer/counter 1 interrupt. ispi/i2ci 9 spi/i 2 c interrupt. ri/ti 10 uart serial port interrupt. tf2/exf2 11 (lowest) timer/counter 2 interrupt. 1 this feature is not av ailable in the ADE7116.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 95 of 152 interrupt flags the interrupt flags and status flags associated with the interrupt vectors are shown in tabl e 82 and table 83 . most of the interrupts have flags associated with them. table 82. interrupt flags interrupt source flag bit name description ie0 tcon.1 ie0 external interrupt 0. tf0 tcon.5 tf0 timer 0. ie1 tcon.3 ie1 external interrupt 1. tf1 tcon.7 tf1 timer 1. ri + ti scon.1 ti transmit interrupt. scon.0 ri receive interrupt. tf2 + exf2 t2con.7 tf2 timer 2 overflow flag. t2con.6 exf2 timer 2 external flag. itemp (temperature adc) 1 n/a n/a temperature adc interrupt. does not have an interrupt flag associated with it. ipsm (power supply) ipsmf.6 fpsm psm interrupt flag. iade (energy measurement dsp) mirqstl.7 adeirqflag read mirqsth, mirqstm, mirqstl. 1 this feature is not av ailable in the ADE7116. table 83. status flags interrupt source flag bit address description itemp (temperature adc) 1 n/a n/a temperature adc interrupt. does not have a status flag associated with it. ispi/i2ci spi2cstat n/a spi interrupt status register. spi2cstat n/a i 2 c interrupt status register. irtc (rtc interval timer) timecon.7 midnight rtc midnight flag. timecon.2 alarm rtc alarm flag. wdt (watchdog timer) wdcon.2 wds watchdog timeout flag. 1 this feature is not av ailable in the ADE7116. a functional block diagram of the interrupt system is shown in figure 89 . note that the psm interrupt is the only interrupt in the highest priority level. if an external wake-up event occurs to wake the ADE7116/ ade7156/ade7166/ade7169/ade7566/ade7569 from psm2 mode, a pending external interrupt is generated. when the ex0 bit (bit 0) or the ex1 bit (bit 2) in the interrupt enable sfr (ie, address 0xa8) is set to enable external interrupts, the program counter is loaded with the ie0 or ie1 interrupt vector. the ie0 and ie1 interrupt flags (bit 1 and bit 3, respectively) in the timer/counter 0 and timer/counter 1 control sfr (tcon, address 0x88) are not affected by events that occur when the 8052 mcu core is shut down during psm2. see the power supply management (psm) interrupt section. the rtc, temperature adc, and i 2 c/spi interrupts are latched such that pending interrupts cannot be cleared without entering their respective interrupt service routines. clearing the rtc midnight flags and alarm flags does not clear a pending rtc interrupt. similarly, clearing the i 2 c/spi status bits in the spi interrupt status sfr (spistat, address 0xea) does not cancel a pending i 2 c/spi interrupt. these interrupts remain pending until the rtc or i 2 c/spi interrupt vectors are enabled. their respective interrupt service routines are entered shortly thereafter. figure 89 shows how the interrupts are cleared when the interrupt service routines are entered. some interrupts with multiple interrupt sources are not automatically cleared; specifically, the psm, ade, uart, and timer 2 interrupt vectors. note that the int0 and int1 interrupts are only cleared only if the external interrupt is configured to be triggered by a falling edge by setting it0 (bit 0) in the timer/counter 0 and timer/counter 1 control sfr (tcon, address 0x88). if int0 or int1 is configured to interrupt on a low level, the interrupt service routine is reentered until the respective pin goes high.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 96 of 152 ipsmf fpsm (ipsmf.6) ipsme individual interrupt enable ie/ieip2 registers ip/ieip2 registers watchdog timeout wdir low high highest midnight alarm in out latch reset mirqsth mirqstm mirqstl mirqenh mirqenm mirqenl mirqstl.7 tempadc interrupt in out latch reset int0 it0 0 1 ie0 tf0 int1 it1 0 1 tf1 cfg.5 0 1 i 2 c interrupt spi interrupt ri ti tf2 exf2 interrupt polling sequence psm rtc ade watchdog temp adc* external interrupt 0 timer 0 external interrupt 1 timer 1 i 2 c/spi uart timer 2 automatic clear signal legend it0 ie1 it1 psm2 psm2 priority level global interrupt enable (ea) in out latch reset 06353-064 *not available in the ADE7116. figure 89. interrupt system functional block diagram
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 97 of 152 interrupt vectors when an interrupt occurs, the program counter is pushed onto the stack, and the corresponding interrupt vector address is loaded into the program counter. when the interrupt service routine is complete, the program counter is popped off the stack by an reti instruction. this allows program execution to resume from where it was interrupted. the interrupt vector addresses are shown in table 84 . table 84. interrupt vector addresses source vector address ie0 0x0003 tf0 0x000b ie1 0x0013 tf1 0x001b ri + ti 0x0023 tf2 + exf2 0x002b itemp (temperature adc) 1 0x0033 ispi/i2ci 0x003b ipsm (power supply) 0x0043 iade (energy measurement dsp) 0x004b irtc (rtc interval timer) 0x0053 wdt (watchdog timer) 0x005b 1 this feature is not av ailable in the ADE7116. interrupt latency the 8052 architecture requires that at least one instruction execute between interrupts. to ensure this, the 8052 mcu core hardware prevents the program counter from jumping to an isr immediately after completing an reti instruction or an access of the ip and ie sfrs. the shortest interrupt latency is 3.25 instruction cycles, 800 ns with a clock of 4.096 mhz. the longest interrupt latency for a high priority interrupt results when a pending interrupt is generated during a low priority interrupt reti, followed by a multiply instruction. this results in a maximum interrupt latency of 16.25 instruction cycles, 4 s with a clock of 4.096 mhz. context saving when the 8052 vectors to an interrupt, only the program counter is saved on the stack. therefore, the interrupt service routine must be written to ensure that registers used in the main program are restored to their pre-interrupt state. common sfrs that can be modified in the isr are the accumulator register and the psw register. any general-purpose registers that are used as scratch pads in the isr should also be restored before exiting the interrupt. the following example 8052 code shows how to restore some commonly used registers: generalisr: ; save the current accumulator value push acc ; save the current status and register bank selection push psw ; service interrupt ? ; restore the status and register bank selection pop psw ; restore the accumulator pop acc reti
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 98 of 152 watchdog timer the watchdog timer generates a device reset or interrupt within a reasonable amount of time if the ADE7116/ade7156/ade7166/ ade7169/ade7566/ade7569 enter an erroneous state, possibly due to a programming error or electrical noise. the watchdog is enabled by default with a timeout of two seconds and creates a system reset if not cleared within two seconds. the watchdog function can be disabled by clearing the watchdog enable bit (wde, bit 1) in the watchdog timer sfr (wdcon, address 0xc0). the watchdog circuit generates a system reset or interrupt (wds, bit 2) if the user program fails to set the wde bit within a predetermined amount of time (set by the pre bits). the watchdog timer is clocked from the 32.768 khz external crystal connected between the xtal1 and xtal2 pins. the wdcon sfr can be written to by user software only if the double write sequence described in table 85 is initiated on every write access to the wdcon sfr. to prevent any code from inadvertently disabling the watchdog, a watchdog protection can be activated. this watchdog protection locks in the watchdog enable and event settings so they cannot be changed by user code. the protection is activated by clearing a watchdog protection bit in the flash memory. the watchdog protection bit is the most significant bit at address 0x3ffa of the flash memory. when this bit is cleared, the wdir bit (bit 3) is forced to 0, and the wde bit is forced to 1. note that the sequence for configuring the flash protection bits must be followed to modify the watchdog protection bit at address 0x3ffa (see the protecting the flash section). table 85. watchdog timer sfr (wdcon, address 0xc0) bit address mnemonic default description [7:4] 0xc7 to 0xc4 pre 7 watchdog prescaler. in normal mode, the 16- bit watchdog timer is clocked by the input clock (32.768 khz). the pre bits set which of th e upper bits of the counter are used as the watchdog output, as follows: clkin t pre watchdog 9 2 2 = pre result (watchdog timeout) 0000 15.6 ms 0001 31.2 ms 0010 62.5 ms 0011 125 ms 0100 250 ms 0101 500 ms 0110 1 sec 0111 2 sec 1000 0 sec, automatic reset 1001 0 sec, serial download reset 1010 to 1111 not a valid selection 3 0xc3 wdir 0 watchdog interrupt response bit. when cleared, the watchdog generates a system reset when the watchdog timeout period has expired. when set, the watchdog generates an interrupt when the watchdog timeout period has expired. 2 0xc2 wds 0 watchdog status bit. this bit is set to indica te that a watchdog timeout has occurred. it is cleared by writing a 0 or by an external hard ware reset. a watchdog reset does not clear wds; therefore, it can be used to distinguish between a watchdog reset and a hardware reset from the reset pin. 1 0xc1 wde 1 watchdog enable bit. when set, this bit enables the watchdog and clears its counter. the watchdog counter is subsequently cleared agai n whenever wde is set. if the watchdog is not cleared within its selected timeout period, it generates a system reset or watchdog interrupt, depending on the wdir bit. 0 0xc0 wdwr 0 watchdog write enable bit (see the writing to the watchdog timer sfr (wdcon, address 0xc0) section).
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 99 of 152 table 86. watchdog and flash protection byte in flash (flash address = 0x3ffa) bit mnemonic default description 7 wdprot_protky7 1 this bit holds the protection for the watchd og timer and the seventh bit of the flash protection key. when this bit is cleared, the watchdog enable and event bits wde and wdir cannot be changed by user code. the watchdog configuration is then fixed to wdir = 0 and wde = 1. the watchdog timeout in the pre bits can sti ll be modified by user code. the value of this bit is also used to set the flash pr otection key. if this bit is cleared to protect the watchdog, then the default value for the flash pr otection key is 0x7f instead of 0xff (see the protecting the flash section for more information on how to clear this bit). [6:0] protky[6:0] 0xff these bits hold the flash protection key. the co ntent of this flash address is compared to the flash protection key sfr (protky, address 0xbb) wh en the protection is being set or changed. if the two values match, the new protection is written to the flash address 0x3fff to address 0x3ffb. see the protecting the flash section for more information on how to configure these bits. writing to the watchdog timer sfr (wdcon, address 0xc0) writing data to the wdcon sfr involves a double instruction sequence. the wdwr (bit 0) bit must be set, and the following instruction must be a write instruction to the wdcon sfr. ; disable watchdog clr ea setb wdwr clr wde setb ea this sequence is necessary to protect the wdcon sfr from code execution upsets that may unintentionally modify this sfr. interrupts should be disabled during this operation due to the consecutive instruction cycles. watchdog timer interrupt if the watchdog timer is not cleared within the watchdog timeout period, a system reset occurs unless the watchdog timer interrupt is enabled. the watchdog timer interrupt response bit (wdir, bit 3) is located in the watchdog timer sfr (wdcon, address 0xc0). enabling the wdir bit allows the program to examine the stack or other variables that may have led the program to execute inappropriate code. the watchdog timer interrupt also allows the watchdog to be used as a long interval timer. note that wdir is automatically configured as a high priority interrupt. this interrupt cannot be disabled by the ea bit (bit 7) in the interrupt enable sfr (ie, address 0xa8; see table 78 ). even if all of the other interrupts are disabled, the watchdog is kept active to watch over the program.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 100 of 1 52 lcd driver using shared pins, the lcd module is capable of directly driving an lcd panel of 17 4 segments without compromising any ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 functions. it is capable of driving lcds with 2, 3, and 4 multi- plexing. the lcd waveform voltages generated through internal charge pump circuitry support up to 5 v lcds for the ade7156/ ade7166/ade7169/ade7566/ade7569. an external resistor ladder for lcd waveform voltage generation is also supported. each ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 has an embedded lcd control circuit, driver, and power supply circuit. the lcd module is functional in all operating modes (see the operating modes section). lcd registers there are six lcd control registers that configure the driver for the specific type of lcd in the end system and set up the user display preferences. the lcd configuration sfr (lcdcon, address 0x95), lcd configuration x sfr (lcdconx, address 0x9c), and lcd configuration y sfr (lcdcony, address 0xb1) contain general lcd driver configuration information including the lcd enable and reset, as well as the method of lcd voltage generation and multiplex level. the lcd clock sfr (lcdclk, address 0x96) configures timing settings for lcd frame rate and blink rate. lcd pins are configured for lcd functionality in the lcd segment enable sfr (lcdsege, address 0x97) and the lcd segment enable 2 sfr (lcdsege2, address 0xed). table 87. lcd driver sfrs sfr address r/w mnemonic description 0x95 r/w lcdcon lcd configuration sfr (see table 88 ). 0x96 r/w lcdclk lcd clock (see table 92 ). 0x97 r/w lcdsege lcd segment enable (see table 95 ). 0x9c r/w lcdconx lcd configuration x (see table 89 ). 0xac r/w lcdptr lcd pointer (see table 96 ). 0xae r/w lcddat lcd data (see table 97 ). 0xb1 r/w lcdcony lcd configuration y (see table 91 ). 0xed r/w lcdsege2 lcd segment enable 2 (see table 98 ). table 88. lcd configuration sfr (lcdcon, address 0x95) bit mnemonic default description 7 lcden 0 lcd enable. if this bit is set, the lcd driver is enabled. 6 lcdrst 0 lcd data registers reset. if this bit is set, the lcd data registers are reset to 0. 5 blinken 0 blink mode enable bit. if this bit is set, blink mode is enabled. the blink mode is configured by the blkmod and blkfreq bits in the lcd clock sfr (lcdclk, address 0x96). 4 lcdpsm2 0 forces lcd off when in psm2 (sleep) mode. note that the internal voltage reference must be enabled by setting the ref_bat_en bit in the peripheral conf iguration sfr (periph, address 0xf4) to allow lcd operation in psm2 mode. lcdpsm2 result 0 the lcd is disabled or enabled in psm2 by the lcden bit 1 the lcd is disabled in psm2 regardless of lcden setting 3 clksel 0 lcd clock selection. clksel result 0 f lcdclk = 2048 hz 1 f lcdclk = 128 hz 2 bias 0 bias mode. bias result 0 1/2 1 1/3 [1:0] lmux 0 lcd multiplex level. lmux result 00 reserved. 01 2 multiplexing. fp27/com3 is used as fp27, and fp28/com2 is used as fp28. 10 3 multiplexing. fp27/com3 is used as fp27, and fp28/com2 is used as com2. 11 4 multiplexing. fp27/com3 is used as com3, and fp28/com2 is used as com2.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 101 of 152 table 89. lcd configuration x sfr (lcdconx, address 0x9c) bit mnemonic default description 7 reserved 0 reserved. 6 extres 0 external resistor ladder selection bit. extres result 0 external resistor ladder is disabled. charge pump is enabled. 1 external resistor ladder is enab led. charge pump is disabled. [5:0] biaslv 0 bias level selection bits. see table 90. 1 1 this feature is not av ailable in the ADE7116. table 90. lcd bias voltage when contrast control is enabled 1 biaslvl[5] v a (v) 1/2 bias 1/3 bias v b v c v b v c 0 [ ] 31 04blvl v ref : v b = v a v c = 2 v a v b = 2 v a v c = 3 v a 1 [ ] ? ? ? ? ? ? + 31 0:4blvl 1v ref v b = v a v c = 2 v a v b = 2 v a v c = 3 v a 1 this feature is not av ailable in the ADE7116. table 91. lcd configuration y sfr (lcdcony, address 0xb1) bit mnemonic default description 7 reserved 0 this bit should be kept cleared for proper operation. 6 inv_lvl 0 frame inversion mode enable bit. if this bit is set, frames are inverted every other frame. if this bit is cleared, frames are not inverted. [5:2] reserved 0000 these bits should be kept cleared to 0 for proper operation. 1 updateover 0 update finished flag bit. this bi t is updated by the lcd driver. when set, this bit indicates that the lcd memory has been updated and a new frame has begun. 0 refresh 0 refresh lcd data memory bit. this bit should be set by the user. when set, the lcd driver does not use the data in the lcd data registers to update the display. the lcd data registers can be updated by the 8052. when cleared, the lcd driver uses the data in the lcd data registers to update display at the next frame. table 92. lcd clock sfr (lcdclk, address 0x96) bit mnemonic default description [7:6] blkmod 0 blink mode clock source configuration bits. blkmod result 00 the blink rate is controlled by software; the display is off. 01 the blink rate is controlled by software; the display is on. 10 the blink rate is 2 hz. 11 the blink rate is set by blkfreq. [5:4] blkfreq 0 blink rate configuration bits. these bits control the lcd blink rate if the blkmod bits = 11. blkfreq result (blink rate) 00 1 hz 01 1/2 hz 10 1/3 hz 11 1/4 hz [3:0] fd 0 lcd frame rate selection bits. see table 93 and table 94.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 102 of 1 52 table 93. lcd frame rate selection for f lcdclk = 2048 hz (lcdcon[3] = 0) 2 multiplexing 3 multiplexing 4 multiplexing fd3 fd2 fd1 fd0 f lcd (hz) frame rate (hz) f lcd (hz) frame rate (hz) f lcd (hz) frame rate (hz) 0 0 0 1 256 128 1 341.3 170.7 1 512 128 1 0 0 1 0 170.7 85.3 341.3 113.8 1 341.3 85.3 0 0 1 1 128 64 256 85.3 256 64 0 1 0 0 102.4 51.2 204.8 68.3 204.8 51.2 0 1 0 1 85.3 42.7 170.7 56.9 170.7 42.7 0 1 1 0 73.1 36.6 146.3 48.8 146.3 36.6 0 1 1 1 64 32 128 42.7 128 32 1 0 0 0 56.9 28.5 113.8 37.9 113.8 28.5 1 0 0 1 51.2 25.6 102.4 34.1 102.4 25.6 1 0 1 0 46.5 23.25 93.1 31 93.1 23.25 1 0 1 1 42.7 21.35 85.3 28.4 85.3 21.35 1 1 0 0 39.4 19.7 78.8 26.3 78.8 19.7 1 1 0 1 36.6 18.3 73.1 24.4 73.1 18.3 1 1 1 0 34.1 17.05 68.3 22.8 68.3 17.05 1 1 1 1 32 16 64 21.3 64 16 0 0 0 0 16 8 32 10.7 32 8 1 not within the range of typical lcd frame rates. table 94. lcd frame rate selection for f lcdclk = 128 hz (lcdcon[3] = 1) 2 multiplexing 3 multiplexing 4 multiplexing fd3 fd2 fd1 fd0 f lcd (hz) frame rate (hz) f lcd (hz) frame rate (hz) f lcd (hz) frame rate (hz) 0 0 0 1 32 16 1 32 10.7 32 8 0 0 1 0 21.3 10.6 32 10.7 32 8 0 0 1 1 16 8 32 10.7 32 8 0 1 0 0 16 8 32 10.7 32 8 0 1 0 1 16 8 32 10.7 32 8 0 1 1 0 16 8 32 10.7 32 8 0 1 1 1 16 8 32 10.7 32 8 1 0 0 0 16 8 32 10.7 32 8 1 0 0 1 16 8 32 10.7 32 8 1 0 1 0 16 8 32 10.7 32 8 1 0 1 1 16 8 32 10.7 32 8 1 1 0 0 16 8 32 10.7 32 8 1 1 0 1 16 8 32 10.7 32 8 1 1 1 0 16 8 32 10.7 32 8 1 1 1 1 128 64 128 42.7 128 32 0 0 0 0 64 32 64 21.3 64 16 1 not within the range of typical lcd frame rates.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 103 of 1 52 table 95. lcd segment enable sfr (lcdsege, address 0x97) bit mnemonic default description 7 fp25en 0 fp25 function select bit. 0 = general-purpose i/o, 1 = lcd function. 6 fp24en 0 fp24 function select bit. 0 = general-purpose i/o, 1 = lcd function. 5 fp23en 0 fp23 function select bit. 0 = general-purpose i/o, 1 = lcd function. 4 fp22en 0 fp22 function select bit. 0 = general-purpose i/o, 1 = lcd function. 3 fp21en 0 fp21 function select bit. 0 = general-purpose i/o, 1 = lcd function. 2 fp20en 0 fp20 function select bit. 0 = general-purpose i/o, 1 = lcd function. [1:0] reserved 0 these bits must be kept at 0 for proper operation. table 96. lcd pointer sfr (lcdptr, address 0xac) bit mnemonic default description 7 r /w 0 read or write lcd bit. if this bit is set to 1, the data in lcd data sfr (lcddat, address 0xae) is written to the address indicated by the address bits (lcdptr, address 0xac). 6 reserved 0 reserved. [5:0] address 0 lcd memory address (see table 99 ). table 97. lcd data sfr (lcddat, address 0xae) bit mnemonic default description [7:0] lcddata 0 data to be written into or read out of the lcd memory sfrs. table 98. lcd segment enable 2 sfr (lcdsege2, address 0xed) bit mnemonic default description [7:4] reserved 0 reserved. 3 fp19en 0 fp19 function select bit. 0 = general-purpose i/o, 1 = lcd function. 2 fp18en 0 fp18 function select bit. 0 = general-purpose i/o, 1 = lcd function. 1 fp17en 0 fp17 function select bit. 0 = general-purpose i/o, 1 = lcd function. 0 fp16en 0 fp16 function select bit. 0 = general-purpose i/o, 1 = lcd function. lcd setup the lcd configuration sfr (lcdcon, address 0x95) configures the lcd module to drive the type of lcd in the user end system. the bias bit (bit 2) and the lmux bits in this sfr should be set according to the lcd specifications. the com2/fp28 and com3/fp27 pins default to lcd segment lines. selecting the 3 multiplex level in the lcd configuration sfr (lcdcon, address 0x95) by setting lmux[1:0] to 10 changes the fp28 pin functionality to com2. the 4 multiplex level selection, lmux[1:0] = 11, changes the fp28 pin functionality to com2 and the fp27 pin functionality to com3. the lcd segments of fp0 to fp15 and fp26 are enabled by default. additional pins are selected for lcd functionality in the lcd segment enable sfr (lcdsege, address 0x97) and lcd segment enable 2 sfr (lcdsege2, address 0xed) where there are individual enable bits for the fp16 to fp25 segment pins. the lcd pins do not have to be enabled sequentially. for example, if the alternate function of fp23, the timer 2 input, is required, any of the other shared pins, fp16 to fp25, can be enabled instead. the display element control section contains details about setting up the lcd data memory to turn individual lcd segments on and off. setting the lcdrst bit (bit 6) in the lcd configuration sfr (lcdcon, address 0x95) resets the lcd data memory to its default (0). a power-on reset also clears the lcd data memory. lcd timing and waveforms an lcd segment acts like a capacitor that is charged and discharged at a certain rate. this rate, the refresh rate, determines the visual characteristics of the lcd. a slow refresh rate results in the lcd blinking on and off between refreshes. a fast refresh rate presents a screen that appears to be continuously lit. in addition, a faster refresh rate consumes more power. the frame rate, or refresh rate, for the lcd module is derived from the lcd clock, f lcdclk . the lcd clock is selected as 2048 hz or 128 hz by the clksel bit (bit 3) in the lcd configuration sfr (lcdcon, address 0x95). the minimum refresh rate needed for the lcd to appear solid (without blinking) is independent of the multiplex level.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 104 of 1 52 the lcd waveform frequency, f lcd , is the frequency at which the lcd switches the active common line. thus, the lcd waveform frequency depends heavily on the multiplex level. the frame rate and lcd waveform frequency are set by f lcdclk , the multiplex level, and the fd[3:0] frame rate selection bits in the lcd clock sfr (lcdclk, address 0x96). the lcd module provides 16 different frame rates for f lcdclk = 2048 hz, ranging from 8 hz to 128 hz for an lcd with 4 multiplexing. fewer options are available with f lcdclk = 128 hz, ranging from 8 hz to 32 hz for a 4 multi- plexed lcd. the 128 hz clock is beneficial for battery operation because it consumes less power than the 2048 hz clock. the frame rate is set by the fd bits in the lcd clock sfr (lcdclk, address 0x96); see tabl e 93 and table 94 . the lcd waveform is inverted at twice the lcd waveform frequency, f lcd . this way, each frame has an average dc offset of 0. adc offset degrades the lifetime and performance of the lcd. blink mode blink mode is enabled by setting the blinken bit (bit 5) in the lcd configuration sfr (lcdcon, address 0x95). this mode is used to alternate between the lcd on state and lcd off state so that the lcd screen appears to blink. there are two blinking modes: a software controlled blink mode and an automatic blink mode. software controlled blink mode the lcd blink rate can be controlled by user code with the blkmod bits in the lcd clock sfr (lcdclk, address 0x96) by toggling the bits to turn the display on and off at a rate determined by the mcu code. automatic blink mode there are five blink rates available if the rtc peripheral is enabled. these blink rates are selected by the blkmod and blkfreq bits in the lcd clock sfr (lcdclk, address 0x96); see tabl e 92 . display element control a bank of 15 bytes of data memory located in the lcd module controls the on or off state of each segment of the lcd. the lcd data memory is stored in address 0 through address 14 in the lcd module. each byte configures the on and off states of two segment lines. the lsbs store the state of the even numbered segment lines, and the msbs store the state of the odd numbered segment lines. for example, lcd data address 0 refers to segment line 1 and segment line 0 (see table 99 ). note that the lcd data memory is maintained in the psm2 operating mode. the lcd data memory is accessed indirectly through the lcd pointer sfr (lcdptr, address 0xac) and lcd data sfr (lcddat, address 0xae). moving a value to the lcdptr sfr selects the lcd data byte to be accessed and initiates a read or write operation (see table 96 ). writing to lcd data registers to update the lcd data memory, first set the lsb of the lcd configuration y sfr (lcdcony, address 0xb1) to freeze the data being displayed on the lcd while updating it. this operation ensures that the data displayed on the screen does not change while the data is being changed. then, move the data to the lcd data sfr (lcddat, address 0xae) prior to accessing the lcd pointer sfr (lcdptr, address 0xac). when the msb of the lcd pointer sfr (lcdptr, address 0xac) is set, the content of the lcd data sfr (lcddat, address 0xae) is transferred to the internal lcd data memory designated by the address in the lcdptr sfr. clear the lsb of the lcd configuration y sfr (lcdcony, address 0xb1) when all of the data memory has been updated to allow the use of the new lcd setup for display. sample 8052 code to update the segments attached to fp10 and fp11 pins, use the following sample 8052 code: orl lcdcony,#01h ;start updating the data mov lcddat,#ffh mov lcdptr,#80h or 05h anl lcdcony,#0feh ;update finished reading lcd data registers when the msb of the lcd pointer sfr (lcdptr, address 0xac) is cleared, the content of the lcd data memory address designated by lcdptr is transferred to the lcd data sfr (lcddat, address 0xae). sample 8052 code to read the contents of lcd data memory address 0x07, which holds the on and off state of the segments attached to fp14 and fp15, is as follows. mov lcdptr,#07h mov r1, lcddat
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 105 of 1 52 table 99. lcd data memory accessed indirectly through lcd pointer sfr (lcdptr, a ddress 0xac) and lcd data sfr (lcddat, address 0xae) 1 , 2 lcd pointer sfr (lcdptr, address 0xac) lcd pointer sfr (lcddat, address 0xae) lcd memory address com3 com2 com1 com0 com3 com2 com1 com0 0x0e fp28 fp28 fp28 fp28 0x0d fp27 fp27 fp27 fp27 fp26 fp26 fp26 fp26 0x0c fp25 fp25 fp25 fp25 fp24 fp24 fp24 fp24 0x0b fp23 fp23 fp23 fp23 fp22 fp22 fp22 fp22 0x0a fp21 fp21 fp21 fp21 fp20 fp20 fp20 fp20 0x09 fp19 fp19 fp19 fp19 fp18 fp18 fp18 fp18 0x08 fp17 fp17 fp17 fp17 fp16 fp16 fp16 fp16 0x07 fp15 fp15 fp15 fp15 fp14 fp14 fp14 fp14 0x06 fp13 fp13 fp13 fp13 fp12 fp12 fp12 fp12 0x05 fp11 fp11 fp11 fp11 fp10 fp10 fp10 fp10 0x04 fp9 fp9 fp9 fp9 fp8 fp8 fp8 fp8 0x03 fp7 fp7 fp7 fp7 fp6 fp6 fp6 fp6 0x02 fp5 fp5 fp5 fp5 fp4 fp4 fp4 fp4 0x01 fp3 fp3 fp3 fp3 fp2 fp2 fp2 fp2 0x00 fp1 fp1 fp1 fp1 fp0 fp0 fp0 fp0 1 comx designates the common lines. 2 fpx designates the segment lines. v oltage generation t he ade7166/ade7169/ade7566/ade7569 provide two ways to generate the lcd waveform voltage levels. the on-chip charge pump option can generate 5 v. this makes it possible to use 5 v lcds with the 3.3 v ade7166/ade7169/ade7566/ade7569. there is also an option to use an external resistor ladder with a 3.3 v lcd. the extres bit (bit 6) in the lcd configuration x sfr (lcdconx, address 0x9c) selects the resistor ladder or charge pump option. in the ADE7116 only, the resistor driver option is available. when selecting how to generate the lcd waveform voltages, the following should be considered: ? lifetime performance power consumption ? contrast control lifetime performance power consumption in most lcds, a high amount of current is required when the lcd waveforms change state. the external resistor ladder option draws a constant amount of current, whereas the charge pump circuitry allows dynamic current consumption. if the lcd module is used with the internal charge pump option when the display is disabled, the voltage generation is disabled so that no power is consumed by the lcd function. this feature results in significant power savings if the display is turned off during battery operation. contrast control the electrical characteristics of the liquid in the lcd change over temperature. this requires adjustments in the lcd waveform voltages to ensure a readable display. an added benefit of the internal charge pump voltage generation is a configurable bias voltage that can be compensated over temperature and supply to maintain contrast on the lcd. these compensations can be performed based on the ade7166/ade7169/ade7566/ ade7569 temperature and supply voltage measurements (see the temperature, battery, and supply voltage measurements section). this dynamic contrast co ntrol is not easily implemented with external resistor ladder voltage generation. the lcd bias voltage sets the contrast of the display when the charge pump provides the lcd waveform voltages. the ade7166/ade7169/ade7566/ade7569 provide 64 bias levels selected by the biaslvl[5:0] bits in the lcd configuration x sfr (lcdconx, address 0x9c). the voltage level on lcdva, lcdvb, and lcdvc depend on the internal voltage reference value (vref), biaslvl[5:0] select ion, and the biasing selected as described in table 90 . lifetime performance dc offset on a segment degrades its performance over time. the voltages generated through the internal charge pump switch faster than those generated by the external resistor ladder, reducing the likelihood of a dc voltage being applied to a segment and increasing the lifetime of the lcd.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 106 of 1 52 lcd external circuitry the voltage generation selection is made by the extres bit (bit 6) in the lcd configuration x sfr (lcdconx, address 0x9c). this bit is cleared by default for charge pump voltage generation, but it can be set to enable an external resistor ladder. charge pump voltage generation through the charge pump requires external capacitors to store charge. (note that this feature is not available in the ADE7116 or ade7156.) the external connections to lcdva, lcdvb, and lcdvc, as well as to lcdvp1 and lcdvp2, are shown in figure 90 . lcdvc lcdvb lcdva lcdvp1 lcdvp2 charge pump and lcd waveform circuitry 100nf 470nf 470nf 470nf 06353-065 figure 90. external circuitry for charge pump option external resistor ladder to enable the external resistor ladder option, set the extres bit (bit 6) in the lcd configuration x sfr (lcdconx, address 0x9c). when extres = 1, the lcd waveform voltages are supplied by the external resistor ladder. because the lcd voltages are not generated on-chip, the lcd bias compensation implemented to maintain contrast over temperature and supply is not possible. the external circuitry needed for the resistor ladder option is shown in figure 92 . the resistors required should be in the range of 10 k to 100 k and should be based on the current required by the lcd being used. lcdvc lcdvb lcdva lcdvp1 lcdvp2 lcd waveform circuitry 07327-076 figure 91. external circuitry for external resistor ladder option: 1/2 bias configuration lcdvc lcdvb lcdva lcdvp1 lcdvp2 lcd waveform circuitry 06353-066 figure 92. external circuitry for external resistor ladder option: 1/3 bias configuration lcd function in psm2 mode the lcdpsm2 (bit 4) and lcden (bit 7) in the lcd config- uration sfr (lcdcon, address 0x95) control the lcd functionality in the psm2 operating mode (see table 100 ). note that the internal voltage reference must be enabled by setting ref_bat_en bit (bit 3) in the peripheral configuration sfr (periph, address 0xf4) to allow lcd operation in psm2 mode (see table 20 ). table 100. bits controlling lcd functionality in psm2 mode lcdpsm2 lcden result 0 0 the display is off in psm2. 0 1 the display is on in psm2. 1 x the display is off in psm2. i n addition, note that the lcd configuration and data memory is retained when the display is turned off. e xample lcd setup a n example of how to set up the lcd peripheral for a specific lcd is described in this section with the following parameters: ? type of lcd: 5 v, 4 multiplexed with 1/3 bias, 96 segment ? voltage generation: internal charge pump ? refresh rate: 64 hz a 96-segment lcd with 4 multiplexing requires 96/4 = 24 segment lines. sixteen pins, fp0 to fp15, are automatically dedicated for use as lcd segments. eight more pins must be chosen for the lcd function. because the lcd has 4 multi- plexing, all four common lines are used. as a result, com2/fp28 and com3/fp27 cannot be used as segment lines. based on the alternate functions of the pins used for fp16 through fp25, fp16 to fp23 are chosen for the eight remaining segment lines. these pins are enabled for lcd functionality in the lcd segment enable sfr (lcdsege, address 0x97) and lcd segment enable 2 sfr (lcdsege2, address 0xed). to determine contrast setting for this 5 v lcd, table 90 shows the biaslvl[5:0] setting in the lcd configuration x sfr (lcdconx, address 0x9c) that corresponds to a vc of 5 v in 1/3 bias mode. the maximum bias level setting for this lcd is biaslvl[5:0] = 101110.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 107 of 1 52 the lcd is set up with the following 8052 code: ; set up lcd pins to have lcd functionality mov lcdseg,#fp20en+fp21en+fp22en+fp23en mov lcdsegx,#fp16en+fp17en+fp18en+fp19en ; set up lcdcon for f lcdclk =2048hz, 1/3 bias and 4x multiplexing mov lcdcon,#bias+lmux1+lmux0 ; setup lcdconx for charge pump and biaslvl[110111] mov lcdconx,#biaslvl5+biaslvl4+biaslvl3+biaslvl2+biaslvl1+biaslvl0 ; set up refresh rate for 64hz with f lcdclk =2048hz mov lcdclk,#fd3+fd2+fd1+fd0 ; set up lcd data registers with data to be displayed using ; lcdptr and lcddata registers ; turn all segments on fp27 on and fp26 off orl lcdcony,#01h ; start data memory refresh mov lcddat,#f0h mov lcdptr, #80h or 0dh anl lcdcony,#0feh ; end of data memory refresh orl lcdcon,#lcden ; enable lcd to set up the same 3.3 v lcd for use with an external resistor ladder: ; set up lcdconx for external resistor ladder mov lcdconx,#extres
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 108 of 1 52 flash memory flash memory overview flash memory is a type of nonvolatile memory that is in-circuit programmable. the default, erased state of a byte of flash memory is 0xff. when a byte of flash memory is programmed, the required bits change from 1 to 0. the flash memory must be erased to turn the 0s back to 1s. a byte of flash memory cannot, however, be erased individually. the entire segment, or page, of flash memory that contains the byte must be erased. the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 provide 16 kb of flash program/information memory. this memory is segmented into 32 pages that each contain 512 bytes each. to reprogram one byte of flash memory, the other 511 bytes in that page must be erased. the flash memory can be erased by page or all at once in a mass erase. there is a command to verify that a flash write operation has completed successfully. the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 flash memory controller also offers configurable flash memory protection. the 16 kb of flash memory are provided on-chip to facilitate code execution without any external discrete rom device requirements. the program memory can be programmed in- circuit, using the serial download mode provided or using conventional third party memory programmers. flash/ee memory reliability th e flash memory arrays on the ADE7116/ade7156/ ade7166/ade7169/ade7566/ade7569 are fully qualified for two key flash/ee memory characteristics: flash/ee memory cycling endurance and flash/ee memory data retention. en durance quantifies the ability of the flash/ee memory to be cycled through many program, read, and erase cycles. in real terms, a single endurance cycle is composed of four independent, sequential events: 1. initial page erase sequence. 2. read/verify sequence. 3. byte program sequence. 4. second read/verify sequence. in reliability qualification, every byte in both the program and data flash/ee memory is cycled from 0x00 to 0xff until a first fail is recorded, signifying the endurance limit of the on-chip flash/ee memory. as indicated in the specifications section, the ADE7116/ ade7156/ade7166/ade7169/ade7566/ade7569 flash memory endurance qualification has been carried out in accordance with jedec standard 22 method a117 over the industrial temperature range of ?40c, +25c, and +85c. the results allow the specification of a minimum endurance figure over supply and temperature of 100,000 cycles, with a minimum endurance figure of 20,000 cycles of operation at 25c. retention is the ability of the flash memory to retain its programmed data over time. again, the parts have been qualified in accordance with the formal jedec retention lifetime specification (a117) at a specific junction temperature (t j = 55c). as part of this qualification procedure, the flash memory is cycled to its specified endurance limit described previously, before data retention is characterized. this means that the flash memory is guaranteed to retain its data for its full specified retention lifetime every time the flash memory is reprogrammed. it should also be noted that retention lifetime, based on an activation energy of 0.6 ev, derates with t j as shown in figure 93 . 40 60 70 90 t j junction temperature (c) retention (years) 250 200 150 100 50 0 50 80 110 300 100 analog devices specification 100 years min. at t j = 55 c 0 6353-067 figure 93. flash/ee memory data retention
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 109 of 1 52 flash memory organization the 16 kb array of flash memory provided by the ADE7116/ ade7156/ade7166/ade7169/ade7566/ade7569 are segmented into 32 pages of 512 bytes each. it is up to the user to decide which flash memory is to be used for data memory. it is recommended that each page be dedicated solely to program or data memory so that an instance does not arise where the program counter is loaded with data memory instead of an opcode from the program memory or where program memory is erased to update a byte of data memory. 0x3e00 0x3dff 0x3c00 0x3bff 0x3a00 0x39ff 0x3800 0x37ff 0x3600 0x35ff 0x3400 0x33ff 0x3200 0x31ff 0x3000 0x2fff 0x2e00 0x2dff 0x2c00 0x2bff 0x2a00 0x29ff 0x2800 0x27ff 0x2600 0x25ff 0x2400 0x23ff 0x2200 0x21ff 0x2000 0x3fff contains protection settings. read protect bit 7 read protect bit 6 read protect bit 5 read protect bit 4 page 30 page 29 page 28 page 27 page 26 page 25 page 24 page 23 page 22 page 21 page 20 page 19 page 18 page 17 page 16 page 31 0x1e00 0x1dff 0x1c00 0x1bff 0x1a00 0x19ff 0x1800 0x17ff 0x1600 0x15ff 0x1400 0x13ff 0x1200 0x11ff 0x1000 0x0fff 0x0e00 0x0dff 0x0c00 0x0bff 0x0a00 0x09ff 0x0800 0x07ff 0x0600 0x05ff 0x0400 0x03ff 0x0200 0x01ff 0x0000 0x1ff f read pro t ect bit 3 read protect bit 2 read protect bit 1 read protect bit 0 page 14 page 13 page 12 page 11 page 10 page 9 page 8 page 7 page 6 page 5 page 4 page 3 page 2 page 1 page 0 page 15 06353-068 figure 94. flash memory organization the flash memory can be protected from read or write/erase access. the protection is implemented in the upper page of user program memory, page 31. four of the bytes from this page are used to set up write/erase protection for each page. another byte is used for configuring read protection of the flash memory. the read protection is selected in groups of four pages. finally, there is a byte used to store the key required for modifying the protection scheme. the last page of flash memory must be write/erase protected at a minimum. the implication of write/erase protecting the last page is that the content of the 506 bytes in this page that are available to the user must not change. thus, it is recommended that if code protection is enabled, the last page of user accessible flash memory should be used only to store data that does not need modification in the field. if the firmware requires protection and may need updating in the future, the last page should be reserved for constants used by the user code that do not require modification during emulation or debug. page 0 through page 30 are, therefore, available for general program and data memory use. it is recommended that page 31 be used for constants or code that do not require future modifications. note that the last six bytes of page 31 are reserved for the flash memory protection and are, therefore, unavailable to the user. using the flash memory the 16 kb of flash memory are configured as 32 pages, each comprising 512 bytes. as with the other ADE7116/ade 7156/ ade7166/ade7169/ade7566/ade7569 peripherals, the interface to this memory space is via a group of registers mapped in the sfr space (see table 101 ). the flash data sfr, (edata, address 0xbc) holds the byte of data to be accessed. the byte of flash memory is addressed via the eadrh sfr (address 0xc7) and the eadrl sfr (address 0xc6). finally, the econ sfr (address 0xb9) is an 8-bit control register that can be written to with one of seven flash memory access commands to trigger various read, write, erase, and verify functions. table 101. flash sfrs sfr address default bit addressable description econ 0xb9 0x00 no flash control. flshky 0xba 0xff no flash key. protky 0xbb 0xff no flash protection key. edata 0xbc 0x00 no flash data. protb0 0xbd 0xff no flash w/e protection 0. protb1 0xbe 0xff no flash w/e protection 1. protr 0xbf 0xff no flash read protection. eadrl 0xc6 0x00 no flash low byte address. eadrh 0xc7 0x00 no flash high byte address. figure 95 demonstrates the steps required for access to the flash memory.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 110 of 1 52 eadrh flshky eadrl address address decoder flshky = 0 3b? protection decoder econ command access allowed? flash protection key true: access allowed econ = 0 false: access denied econ = 1 0 6353-069 figure 95. flash memory read/write/erase protection block diagram econflash control sfr programming flash memory is done through the flash control sfr (econ, address 0xb9). this sfr allows the user to read, write, erase, or verify the 16 kb of flash memory. as a method of security, a key must be written to the flshky, address 0xba) to initiate any user access to the flash memory. upon completion of the flash memory operation, the flshky sfr is reset such that it must be written to before another flash memory operation. requiring the key to be set before an access to the flash memory decreases the likelihood of user code or data being overwritten by a runaway program. the program counter, pc, is held on the instruction where the econ sfr is written to until the flash memory controller is done performing the requested operation. then, the pc increments to continue with the next instruction. any interrupt requests that occur while the flash controller is performing an operation are not handled until the flash operation is complete. all peripherals, such as timers and counters, continue to operate as configured throughout the flash memory access. table 102. flash control sfr (econ, address 0xb9) bit mnemonic default value description [7:0] econ 0 1 write byte. the value in edata is written to the flash memory at the page address given by eadrh (address 0xc7) and eadrl (address 0xc6). no te that the byte being addressed must be pre-erased. 2 erase page. a 512-byte page of flash memory address is erased. the page is selected by the address in eadrh and eadrl. any address in the page can be written to eadrh and eadrl to select it for erasure. 3 erase all. all 16 kb of the available flash memory are erased. note that this command is used during serial mode and parallel download mode but should not be executed by user code. 4 read byte. the byte in the flash memory addressed by eadrh/eadrl is read into edata. 5 erase page and write byte. the page that holds the byte addressed by eadrh/eadrl is erased. data in edata is then written to the byte of flash memory addressed by eadrh/eadrl. 8 protect code (see the protecting the flash section). table 103. flash key sfr (flshky, address 0xba) bit mnemonic default description [7:0] flshky 0xff the content of this sfr is compared to the flash ke y, 0x3b. if the two values match, the next econ operation is allowed (see the protecting the flash section). table 104. flash protection key sfr (protky, address 0xbb) bit mnemonic default description [7:0] protky 0xff the content of this sfr is compared to the flash me mory location at address 0x3ffa. if the two values match, the update of the write/erase and read protection setup is allowed (see the protecting the flash section). if the protection key in the flash is 0xff, the protky sfr value is not used for comparison. this sfr is also used to write the protection key in the flash. this is done by writing the desired value in protky and by writing 0x08 in the econ sfr. this operation can only be done once. table 105. flash data sfr (edata, address 0xbc) bit mnemonic default description [7:0] edata 0 flash pointer data.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 111 of 1 52 table 106. flash write/erase protection 0 sfr (protb0, address 0xbd) bit mnemonic default description [7:0] protb0 0xff this sfr is used to write the write/erase protection bits for page 0 to page 7 of the flash memory (see the protecting the flash section). clearing the bits enables the protection. protb0.7 protb0.6 protb0.5 protb0.4 protb0.3 protb0.2 protb0.1 protb0.0 page 7 page 6 page 5 page 4 page 3 page 2 page 1 page 0 table 107. flash write/erase protecti on 1 sfr (protb1, address 0xbe) bit mnemonic default description [7:0] protb1 0xff this sfr is used to write the write/erase protection bits for page 8 to page 15 of the flash memory (see the protecting the flash section). clearing the bits enables the protection. protb1.7 protb1.6 protb1.5 protb1.4 protb1.3 protb1.2 protb1.1 protb1.0 page 15 page 14 page 13 page 12 page 11 page 10 page 9 page 8 table 108. flash read protecti on sfr (protr, address 0xbf) bit mnemonic default description [7:0] protr 0xff this sfr is used to write the read protection bi ts for page 0 to page 31 of the flash memory (see the protecting the flash section). clearing the bits enables the protection. protr.7 protr.6 protr.5 protr.4 protr.3 protr.2 protr.1 protr.0 page 28 to page 31 page 24 to page 27 page 20 to page 23 page 16 to page 19 page 12 to page 15 page 8 to page 11 page 4 to page 7 page 0 to page 3 table 109. flash low byte address sfr (eadrl, address 0xc6) bit mnemonic default description [7:0] eadrl 0 flash pointer low byte address. this sfr is also used to write the write/erase protection bits for page 16 to page 23 of the flash memory (see the protecting the flash section). clearing the bits enables the protection. eadrl.7 eadrl.6 eadrl.5 eadrl.4 eadrl.3 eadrl.2 eadrl.1 eadrl.0 page 23 page 22 page 21 page 20 page 19 page 18 page 17 page 16 table 110. flash high byte address sfr (eadrh, address 0xc7) bit mnemonic default description [7:0] eadrh 0 flash pointer high byte address. this sfr is also used to write the write/erase protection bits for page 24 to page 31 of the flash memory (see the protecting the flash section). clearing the bits enables the protection. eadrh.7 eadrh.6 eadrh.5 eadrh.4 e adrh.3 eadrh.2 eadrh.1 eadrh.0 page 31 page 30 page 29 page 28 page 27 page 26 page 25 page 24 flash functions the following sample 8052 code is provided to demonstrate how to use the flash functions. for these examples, flash memory byte 0x3c00 is accessed. write by te write 0xf3 into flash memory byte 0x3c00. mov edata,#f3h ; data to be written mov eadrh,#3ch ; set up byte address mov eadrl,#00h mov flshky,#3bh ; write flash security key. mov econ,#01h ; write byte erase page erase the page containing flash memory byte 0x3c00. mov eadrh,#3ch ; select page through byte address mov eadrl,#00h mov flshky,#3bh ; write flash security key. mov econ,#02h ; erase page
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 112 of 1 52 erase all erase all of the 16 kb flash memory. mov flshky,#3bh ; write flash security key. mov econ,#03h ; erase all read byte read flash memory byte 0x3c00. mov eadrh,#3ch ; setup byte address mov eadrl,#00h mov flshky,#3bh ; write flash security key. mov econ,#04h ; read byte ; data is ready in edata register erase page and write byte erase the page containing flash memory byte 0x3c00 and then write 0xf3 to that address. note that the other 511 bytes in this page are erased. mov edata,#f3h ; data to be written mov eadrh,#3ch ; set up byte address mov eadrl,#00h mov flshky,#3bh ; write flash security key. mov econ,#05h ; erase page and then write byte
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 113 of 1 52 protecting the flash memory two forms of protection are offered for this flash memory: read protection and write/erase protection. the read protection ensures that any pages that are read protected cannot be read by the end user. the write protection ensures that the flash memory cannot be erased or written over. this protects the end system from tampering and can prevent the code from being overwritten in the event of a runaway program. write/erase protection is individually selectable for all 32 pages. read protection is selected in groups of four pages (see figure 94 for the groupings). the protection bits are stored in the last flash memory locations, address 0x3ffa through address 0x3fff (see figure 96 ); four bytes are reserved for write/erase protection, one byte is for read protection, and another byte to set the flash protection key (protky, address 0xbb). the user must enable write/erase protection for the last page, at a minimum, for the entire protection scheme to work. note that the read protection does not prevent movc commands from being executed within the code. there is an additional layer of protection offered by a protection security key (protky). the user can set up a protection security key so that the protection scheme cannot be changed without this key. when the protection key has been configured, it cannot be modified. enabling flash protection by code the protection bytes in the flash can be programmed using the flash controller command and programming econ to 0x08. in this case, the eadrh, eadrl, protb1, and protb0 bytes are used to store the data to be written to the 32 bits of write protection. note that the eadrh and eadrl registers are not used as data pointers here but to store write protection data. 06353-070 protr protky protb0 protb1 eadrl eadrh rp 31:28 rp 27:24 rp 23:20 rp 19:16 rp 15:12 rp 11:8 rp 7:4 rp 3:0 wp 7 wp 6 wp 5 wp 4 wp 3 wp 2 wp 1 wp 0 wp 15 wp 14 wp 13 wp 12 wp 11 wp 10 wp 9 wp 8 wp 23 wp 22 wp 21 wp 20 wp 19 wp 18 wp 17 wp 16 wp 31 wp 30 wp 29 wp 28 wp 27 wp 26 wp 25 wp 24 protection key 0x3fff 0x3ffe 0x3ffd 0x3ffc 0x3ffb 0x3ffa 0x3ff9 0x3e00 wdog lock fi gure 96. flash protection in page 31 the sequence for writing the flash protection follows: 1. set up the eadrh, eadrl, protb1, and protb0 sfrs with the write/erase protection bits. when erased, the protection bits default to 1, like any other bit of flash memory. the default protection setting is for no protection. to enable protection, write a 0 to the bits corresponding to the pages that should be protected. 2. set up the protr sfr with the read protection bits. note that every read protection bit protects four pages. to enable the read protection bit, write a 0 to the bits that should be read protected. 3. to enable the protection key, write to the protky sfr. if enabled, the protection key is required to modify the protection scheme. the protection key, flash memory address 0x3ffa, defaults to 0xff; if the protky register is not written to, it remains 0xff. if the protection key is written to, the protky sfr must be written with this value every time the protection functionality is accessed. note that after the protection key is configured, it cannot be modified. also note that the most significant bit of address 0x3ffa is used to enable a lock mechanism for the watchdog settings (see the watc hdo g ti me r section for more information). 4. run the protection command by writing 0x08 to the econ sfr. 5. reset the chip to activate the new protection. to enable read and write/erase protection for the last page only, use the following 8052 code. writing the flash protection command to the econ sfr initiates programming of the protection bits in the flash. ; enable read protection on the last four pages only mov protr,#07fh ; set up a protection key of 0a3h. this command can be ; omitted to use the default protection key of 0xff mov protky,#0a3h ; write the flash key to the flshky register to enable flash ; access. the flash access key is not configurable. mov flshky,#3bh ; write flash protection command to the econ register mov econ,#08h
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 114 of 1 52 en abling flash protection by emulator commands another way to set the flash protection bytes is to use the reserved emulator commands available only in download mode. these commands write directly to the sfrs and can be used to duplicate the operation described in the enabling flash protection by code section. when these flash bytes are written, the part can exit emulation mode by reset and the protections are effective. this method can be used in production and implemented after downloading the program. the commands used for this operation are an extension of the commands listed in application note uc004, understanding the serial download protocol , available at www.analog.com . ? c ommand with ascii code i or 0x49 writes the data into r0. ? c ommand with ascii code f or 0x46 writes r0 into the sfr address defined in the data of this command. omitting the protocol defined in uc004, the sequence to load protections is similar to the sequence mentioned in the enabling flash protection by code section, except that two emulator commands are necessary to replace one assembly command. for example, to write the protection value in eadrh (address 0xc7), the following two commands must be executed: ? command i with data = value of protection byte 0x3fff. ? command f with data = 0xc7. with this protocol, the protection can be written to the flash memory using the same sequence as described in the enabling flash protection by code section. when the part is reset, the protection is effective. notes on flash protection the flash protection scheme is disabled by default so that none of the pages of the flash are protected from reading or writing/ erasing. the last page must be write/erase protected for the protection scheme to work. to activate the protection settings, the ADE7116/ade7156/ ade7166/ade7169/ade7566/ade7569 must be reset after configuring the protection. after configuring protection on the last page and resetting the part, protections that have been enabled can be removed only by mass erasing the flash memory. the protection bits are read and erase protected by enabling read and write/erase protection on the last page, but the protection bits are never truly write protected. protection bits can be modified from a 1 to a 0, even after the last page has been protected. in this way, more protection can be added but none can be removed. when the last page is read protected, the protection bits can still be read by the user code. all other bits on this page are not available for reading. the protection scheme is intended to protect the end system. pro- tection should be disabled while developing and emulating code. flash memory timing typical program and erase times for the flash memory are shown in table 111 . table 111. flash memory program and erase times command bytes affected flash memory timing write byte 1 byte 30 s erase page 512 bytes 20 ms erase all 16 kb 200 ms read byte 1 byte 100 ns erase page and write byte 512 bytes 21 ms verify byte 1 byte 100 ns note that the core microcontroller operation is idled until the requested flash memory operation is complete. in practice, this means that even though the flash operation is typically initiated with a two-machine-cycle mov instruction to write to the flash control sfr (econ, address 0xb9), the next instruction is not executed until the flash/ee operation is complete. this means that the core cannot respond to interrupt requests until the flash/ee operation is complete, although the core peripheral functions, such as counter/timers, continue to count, as configured throughout this period. in-circuit programming serial downloading the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 facilitate code download via the standard uart serial port. the parts enter serial download mode after a reset or a power cycle if the sden pin is pulled low through an external 1 k resistor. once in serial download mode, the hidden embedded download kernel executes. this allows the user to download code to the full 16 kb of flash memory while the device is in-circuit in its target application hardware. protection configured in the last page of the ADE7116/ade7156/ ade7166/ade7169/ade7566/ade7569 affects whether flash memory can be accessed in serial download mode. read protected pages cannot be read. write/erase protected pages cannot be written or erased.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 115 of 1 52 timers each ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 has three 16-bit timer/counters: timer/counter 0, timer/counter 1, and timer/counter 2. the timer/counter hardware is included on-chip to relieve the processor core of overhead inherent in implementing timer/counter functionality in software. each timer/counter consists of two 8-bit registers: thx and tlx (x = 0, 1, or 2). all three timers can be configured to operate as timers or as event counters. when functioning as a timer, the tlx sfr is incremented every machine cycle. (users can think of it as counting machine cycles.) because a machine cycle on a single-cycle core consists of one core clock period, the maximum count rate is the core clock frequency. when functioning as a counter, the tlx register is incremented by a 1-to-0 transition at its corresponding external input pin: t0, t1, or t2. when the samples show a high in one cycle and a low in the next cycle, the count is incremented. because it takes two machine cycles (two core clock periods) to recognize a 1-to-0 transition, the maximum count rate is half the core clock frequency. there are no restrictions on the duty cycle of the external input signal, but to ensure that a given level is sampled at least once before it changes, it must be held for a minimum of one full machine cycle. user configuration and control of all timer operating modes is achieved via the sfrs listed in table 112 . table 112. timer sfrs sfr address bit addressable description tcon 0x88 yes timer/counter 0 and timer/counter 1 control (see table 114 ). tmod 0x89 no timer/counter 0 and timer./counter 1 mode (see table 113 ). tl0 0x8a no timer 0 low byte (see table 117 ). tl1 0x8b no timer 1 low byte (see table 119 ). th0 0x8c no timer 0 high byte (see table 116 ). th1 0x8d no timer 1 high byte (see table 118 ). t2con 0xc8 yes timer/counter 2 control (see table 115 ). rcap2l 0xca no timer 2 reload/capture low byte (see table 123 ). rcap2h 0xcb no timer 2 reload/capture high byte (see table 122 ). tl2 0xcc no timer 2 low byte ( table 121 ). th2 0xcd no timer 2 high byte (see table 120 ). timer registers table 113. timer/counter 0 and timer/counter 1 mode sfr (tmod, address 0x89) bit mnemonic default description 7 gate1 0 timer 1 gating control. set by software to enable timer/counter 1 only when the int1 pin is high and the tr1 control is set. cleared by software to enable timer 1 whenever the tr1 control bit is set. 6 c/ t1 0 timer 1 timer or counter select bit. set by software to select counter operation (input from t1 pin). cleared by software to select the timer operation (input from internal system clock). [5:4] t1/m1, t1/m0 00 timer 1 mode select bits. t1/m1, t1/m0 result 00 th1 (address 0x8d) operates as an 8-bit timer/counter. tl1 (address 0x8d) serves as 5-bit prescaler. 01 16-bit timer/counter. th1 and tl1 are cascaded; there is no prescaler. 10 8-bit autoreload timer/counter. th1 holds a valu e to reload into tl1 each time it overflows. 11 timer/counter 1 stopped. 3 gate0 0 timer 0 gating control. set by software to enable timer/counter 0 only when the int0 pin is high and the tr0 control bit is set. cleared by software to enable timer 0 whenever the tr0 control bit is set in the timer/counter 0 and timer/counter 1 control sfr (tcon, address 0x88) 2 c/ t0 0 timer 0 timer or counter select bit. set by software to the select counter operation (input from t0 pin). cleared by software to the select timer operation (input from internal system clock). [1:0] t0/m1, t0/m0 00 timer 0 mode select bits. t0/m1, t0/m0 result 00 th0 operates as an 8-bit timer/counter. tl0 serves as a 5-bit prescaler. 01 16-bit timer/counter. th0 and tl0 are cascaded; there is no prescaler. 10 8-bit autoreload timer/counter. th0 holds a valu e to reload into tl0 each time it overflows. 11 tl0 is an 8-bit timer/counter controlled by the standard timer 0 control bits. th0 is an 8-bit timer only, controlled by timer 1 control bits.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 116 of 1 52 table 114. timer/counter 0 and timer/counter 1 control sfr (tcon, address 0x88) bit bit address mnemonic default description 7 0x8f tf1 0 timer 1 overflow flag. set by hardware on a timer/counter 1 overflow. cleared by hardware when the program counter (pc) vectors to the interrupt service routine. 6 0x8e tr1 0 timer 1 run control bit. set by the user to tur n on timer/counter 1. cleared by the user to turn off timer/counter 1. 5 0x8d tf0 0 timer 0 overflow flag. set by hardware on a timer/counter 0 overflow. cleared by hardware when the pc vectors to the interrupt service routine. 4 0x8c tr0 0 timer 0 run control bit. set by the user to tur n on timer/counter 0. cleared by the user to turn off timer/counter 0. 3 0x8b ie1 1 0 external interrupt 1 ( int1 ) flag. set by hardware by a falling edge or by a zero level applied to the external interrupt pin, int1 , depending on the state of bit it1. cleared by hardware when the pc vectors to the interrupt service routine only if the interrupt was transition activated. if level activated, the external requesting source, rather than the on-chip hardware, controls the request flag. 2 0x8a it1 1 0 external interrupt 1 (ie1) trigger type. set by soft ware to specify edge se nsitive detection, that is, 1-to-0 transition. cleared by software to specify level sensitive detection, that is, zero level. 1 0x89 ie0 1 0 external interrupt 0 ( int0 ) flag. set by hardware by a falling edge or by a zero level being applied to the external interrupt pin, int0 , depending on the state of bit it0. cleared by hardware when the pc vectors to the interrupt service routine only if the interrupt was transition activated. if level activated, the exte rnal requesting source, rather than the on-chip hardware, controls the request flag. 0 0x88 it0 1 0 external interrupt 0 (ie0) trigger type. set by software to specify edge sensitive detection, that is, 1-to-0 transition. cleared by software to specify level sensitive detection, that is, zero level. 1 these bits are not used to control timer/counter 0 and timer/counter 1 but are instead used to control and monitor the externa l int0 and int1 interrupt pins. table 115. timer/counter 2 control sfr (t2con, address 0xc8) bit bit address mnemonic default description 7 0xcf tf2 0 timer 2 overflow flag. set by hardware on a timer 2 overflow. tf2 cannot be set when either rclk = 1 or tclk = 1. cleared by user software. 6 0xce exf2 0 timer 2 external flag. set by hardware when either a capture or reload is caused by a negative transition on t2ex pin and exen2 = 1. cleared by user software. 5 0xcd rclk 0 receive clock enable bit. set by the user to enable the serial port to use timer 2 overflow pulses for its receive clock in serial port mode 1 and serial port mode 3. cleared by the user to enable timer 1 overflow to be used for the receive clock. 4 0xcc tclk 0 transmit clock enable bit. set by the user to enable the serial port to use timer 2 overflow pulses for its transmit clock in serial port mode 1 and serial port mode 3. cleared by the user to enable timer 1 overflow to be used for the transmit clock. 3 0xcb exen2 0 timer 2 external enable flag. set by the user to enable a capture or reload to occur as a result of a negative transition on the t2ex pin if timer 2 is not being used to clock the serial port. cleared by the user for timer 2 to ignore events at t2ex. 2 0xca tr2 0 timer 2 start/stop control bit. set by the user to start timer 2. cleared by the user to stop timer 2. 1 0xc9 c/ t2 0 timer 2 timer or counter function select bit. set by the user to select the counter function (input from external t2 pin). cleared by the us er to select the timer function (input from the on-chip core clock). 0 0xc8 cap2 0 timer 2 capture/reload select bit. set by the us er to enable captures on negative transitions at t2ex if exen2 = 1. cleared by the user to enable autoreloads with timer 2 overflows or negative transitions at t2ex when exen2 = 1. wh en either rclk = 1 or tclk = 1, this bit is ignored and the timer is forced to autoreload on timer 2 overflow.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 117 of 152 table 116. timer 0 high byte sfr (th0, address 0x8c) bit mnemonic default description [7:0] th0 0 timer 0 data high byte. table 117. timer 0 low byte sfr (tl0, address 0x8a) bit mnemonic default description [7:0] tl0 0 timer 0 data low byte. table 118. timer 1 high byte sfr (th1, address 0x8d) bit mnemonic default description [7:0] th1 0 timer 1 data high byte. table 119. timer 1 low byte sfr (tl1, address 0x8b) bit mnemonic default description [7:0] tl1 0 timer 1 data low byte. table 120. timer 2 high byte sfr (th2, address 0xcd) bit mnemonic default description [7:0] th2 0 timer 2 data high byte. table 121. timer 2 low byte sfr (tl2, address 0xcc) bit mnemonic default description [7:0] tl2 0 timer 2 data low byte. table 122. timer 2 reload/capture high byte sfr (rcap2h, address 0xcb) bit mnemonic default description [7:0] th2 0 timer 2 reload/ capture high byte. table 123. timer 2 reload/capture low byte sfr (rcap2l, address 0xca) bit mnemonic default description [7:0] tl2 0 timer 2 reload/ capture low byte. timer 0 and timer 1 timer 0 high/low and timer 1 high/low data sfrs each timer consists of two 8-bit sfrs. they are timer 0 high byte (th0, address 0x8c), timer 0 low byte (tl0, address 0x8a), timer 1 high byte (th1, address 0x8d), and timer 1 low byte (tl1, address 0x8b). these sfrs can be used as independent registers or combined into a single 16-bit register, depending on the timer mode configuration (see table 116 to table 119 ). timer/counter 0 and timer/counter 1 operating modes this section describes the operating modes for timer/counter 0 and timer/counter 1. unless otherwise noted, these modes of operation are the same for both timer 0 and timer 1. mode 0 (13-bit timer/counter) mode 0 configures an 8-bit timer/counter. figure 97 shows mode 0 operation. note that the divide-by-12 prescaler is not present on the single-cycle core. control tr0 tf0 tl0 (5 bits) th0 (8 bits) interrupt 06353-071 p0.6/t0 gate i nt0 f core c/t0 = 0 c/t0 = 1 figure 97. timer/counter 0, mode 0 in this mode, the timer register is configured as a 13-bit register. as the count rolls over from all 1s to all 0s, it sets the timer overflow flag, tf0 (address 0x88[5]). tf0 can then be used to request an interrupt. the counted input is enabled to the timer when tr0 = 1 and either gate0 to 0 or int0 = 1. setting gate0 to 1 allows the timer to be controlled by the external input int0 to facilitate pulse width measurements. tr0 is a control bit in the timer/counter 0 and timer/counter 1 control sfr (tcon, address 0x88); the gate0/gate1 bits are in timer/counter 0 and timer/counter 1 mode sfr (tmod, address 0x89). the 13-bit register consists of all eight bits of timer 0 high byte sfr (th0, address 0x8c) and the lower five bits of timer 0 low byte sfr (tl0, address 0x8a). the upper three bits of tl0 sfr are indeterminate and should be ignored. setting the run flag (tr0) does not clear the registers. mode 1 (16-bit timer/counter) mode 1 is the same as mode 0 except that the mode 1 timer register runs with all 16 bits. mode 1 is shown in figure 98 . control tr0 tf0 tl0 (8 bits) th0 (8 bits) interrupt 0 06353-072 p0.6/t0 gate int c/t0 = 0 c/t0 = 1 f core figure 98. timer/counter 0, mode 1
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 118 of 152 mode 2 (8-bit timer/counter with autoreload) mode 2 configures the timer register as an 8-bit counter (tl0) with automatic reload as shown in figure 99 . overflow from tl0 not only sets tf0 but also reloads tl0 with the contents of th0, which is preset by software. the reload leaves th0 unchanged. control tf0 tl0 (8 bits) interrupt reload th0 (8 bits) tr0 06353-073 p0.6/t0 gate int0 c/t = 0 c/t = 1 f core figure 99. timer/counter 0, mode 2 mode 3 (two 8-bit timer/counters) mode 3 has different effects on timer 0 and timer 1. timer 1 in mode 3 simply holds its count. the effect is the same as setting tr1 = 0. timer 0 in mode 3 establishes tl0 and th0 as two separate counters. this configuration is shown in figure 100 . tl0 uses the timer 0 control bits, c/ t , gate0 (see ), tr0 and tf0 (see ), and the table 113 table 114 int0 pin. th0 is locked into a timer function (counting machine cycles) and takes over the use of tr1 and tf1 from timer 1. therefore, th0 controls the timer 1 interrupt. mode 3 is provided for applications requiring an extra 8-bit timer or counter. when timer 0 is in mode 3, timer 1 can be turned on and off by switching it out of and into its own mode 3, or it can be used by the serial interface as a baud rate generator. in fact, timer 1 can be used in any application not requiring an interrupt from timer 1 itself. control core clk/12 tf0 tl0 (8 bits) interrupt p0.6/t0 gate tr0 tf1 th0 (8 bits) interrupt f core /12 tr1 0 in t c/t = 0 c/t = 1 06353-074 f core figure 100. timer/counter 0, mode 3 timer 2 timer/counter 2 data registers timer/counter 2 also has two pairs of 8-bit data registers associated with it: timer 2 high byte sfr (th2, address 0xcd), timer 2 low byte sfr (tl2, address 0xcc), timer 2 reload/ capture high byte sfr (rcap2h, address 0xcb), and timer 2 reload/capture low byte sfr (rcap2l, address 0xca). these are used both as timer data registers and as timer capture/reload registers (see table 120 to table 123 ). timer/counter 2 operating modes the following sections describe the operating modes for timer/counter 2. the operating modes are selected by bits in the timer/counter 2 control sfr (t2con, address 0xc8), as shown in table 115 and table 1 24 . table 124. t2con operating modes rclk (or) tclk cap2 tr2 mode 0 0 1 16-bit autoreload 0 1 1 16-bit capture 1 x 1 baud rate x x 0 off 16-bit autoreload mode the 16-bit autoreload mode has two options that are selected by exen2 (bit 3) in the timer/counter 2 control sfr (t2con, address 0xc8). if exen2 = 0 when timer 2 rolls over, it not only sets tf2 but also causes the timer 2 sfrs to be reloaded with the 16-bit value in both the timer 2 reload/capture high byte sfr (rcap2h, address 0xcb) and timer 2 reload/capture low byte sfr (rcap2l, address 0xca) registers, which are preset by software. if exen2 = 1, timer 2 performs the same events as when exen2 = 0 but adds a 1-to-0 transition at the external input, t2ex, which triggers the 16-bit reload and sets exf2. autoreload mode is shown in figure 101 . 16-bit capture mode the 16-bit capture mode has two options that are selected by exen2 (bit 3) in the timer/counter 2 control sfr (t2con, address 0xc8). if exen2 = 0, timer 2 is a 16-bit timer or counter that, upon overflowing, sets the timer 2 overflow bit (tf2, bit 7). this bit can be used to generate an interrupt. if exen2 = 1, then timer 2 performs the same events as when exen2 = 0, but it adds a l-to-0 transition on the t2e external input, causing the current value in the timer 2 sfrs, tl2 (address 0xcc) and th2 (address 0xcd), to be captured into the rcap2l (address 0xca) and rcap2h (address 0xcb) sfrs, respectively. in addition, the transition at t2ex causes the exf2 bit (bit 6) in the t2con sfr (address 0xc8) to be set, and exf2, like tf2, can generate an interrupt. capture mode is shown in figure 102 . the baud rate generator mode is selected by rclk = 1 and/or tclk = 1.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 119 of 152 in either case, if timer 2 is used to generate the baud rate, the tf2 interrupt flag does not occur. therefore, timer 2 interrupts do not occur and do not have to be disabled. in this mode, the exf2 flag can, however, still cause interrupts that can be used as a third external interrupt. baud rate generation is described as part of the uart serial port operation in the uart serial interface section. tr2 control tl2 (8 bits) th2 (8 bits) reload tf2 exf2 timer interrupt exen2 control transition detector rcap2l rcap2h c/ t2 = 0 06353-075 p1.4/t2 p1.3/ t2ex c/ t2 = 1 f core figure 101. timer/counter 2, 16-bit autoreload mode tf2 p1.4/t2 p1.3/ t2ex tr2 control tl2 (8 bits) th2 (8 bits) capture exf2 timer interrupt exen2 control transition detector rcap2l rcap2h c/ t2 = 1 c/ t2 = 0 06353-076 f core figure 102. timer/counter 2, 16-bit capture mode
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 120 of 152 pll the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 are intended for use with a 32.768 khz watch crystal. a pll locks onto a multiple of this frequency to provide a stable 4.096 mhz clock for the system. the core can operate at this frequency or at binary submultiples of it to allow power savings when maximum core performance is not required. the default core clock is the pll clock divided by 4, or 1.024 mhz. the ade energy measurement clock is derived from the pll clock and is maintained at 4.096 mhz/5 mhz, 819.2 khz across all cd settings. the pll is controlled by the cd bits in the power control sfr (powcon, address 0xc5). to protect erroneous changes to the powcon sfr, a key is required to modify the register. first, the key sfr (kyreg, address 0xc1) is written with the key, 0xa7, and then a new value is written to the powcon sfr. if the pll loses lock, the mcu is reset and the pll_flt bit (bit 4) is set in the peripheral configuration sfr (periph, address 0xf4). set the pllack bit in the start adc measurement sfr (adcgo, address 0xd8) to acknowledge the pll fault, clearing the pll_flt bit. pll registers table 125. power control sfr (powcon, address 0xc5) bit mnemonic default description 7 reserved 1 reserved. 6 meter_off 0 set this bit to 1 to turn off the modulators and en ergy metering dsp circuitry to reduce power if metering functions are not needed in psm0. 5 reserved 0 this bit should be kept at 0 for proper operation. 4 coreoff 0 set this bit to 1 to shut down the core if in the psm1 operating mode. 3 reserved reserved. [2:0] cd 010 controls the core clock frequency (f core ). f core = 4.096 mhz/2 cd . cd result (f core in mhz) 000 4.096 001 2.048 010 1.024 011 0.512 100 0.256 101 0.128 110 0.064 111 0.032 writing to the power control sfr (powcon, address 0xc5) note that writing data to the powcon sfr involves writing 0xa7 into the key sfr (kyreg, address 0xc1) followed by a write to th e powcon sfr. table 126. key sfr (kyreg, address 0xc1) bit mnemonic default description [7:0] kyreg 0 write 0xa7 to the kyreg sfr before writing to the powcon sfr to unlock it. write 0xea to the kyreg sfr before writing to the in tpr, hthsec, sec, min, or hour timekeeping sfrs to unlock them.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 121 of 152 real-time clock (rtc) the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 have an embedded real-time clock (rtc) as shown in figure 103. the external 32.768 khz crystal is used as the clock source for the rtc. calibration is provided to compensate the nominal crystal frequency and for variations in the external crystal frequency over temperature. by default, the rtc is maintained active in all power saving modes. the rtc counters retain their values through watchdog resets and external resets. they are only reset during a power-on reset. 8-bit prescaler second counter sec minute counter min hour counter hour iten alarm event 8-bit interval counter intval sfr interval timebase selection mux rtcen 32.768khz crystal its1 its0 equal? calibration rtccomp tempcal midnight event calibrated 32.768khz 06353-077 hundredths counter hthsec figure 103. rtc implementation rtc sfrs note that none of the real-time clock sfrs are bit addressable. table 127. real-time clock sfr sfr address description timecon 0xa1 rtc configuration (see table 128). hthsec 0xa2 hundredths of a second counter (see table 129). sec 0xa3 seconds counter (see table 130). min 0xa4 minutes counter (see table 131). hour 0xa5 hours counter (see table 132). intval 0xa6 alarm interval (see table 133). rtccomp 0xf6 rtc nominal compensation (see table 134). tempcal 0xf7 rtc temperature compensation (see table 135). protecting the rtc from runaway code to protect the rtc from runaway code, a key must be written to the kyreg sfr (address, 0xc1) to obtain write access to the interrupt pins configuration sfr (intpr, address 0xff), hundredths of a second counter sfr (hthsec, address 0xa2), seconds counter sfr (sec, 0xa3), minutes counter sfr (min, address 0xa4), and hours counter sfr (hour, address 0xa5). kyreg should be set to 0xea to unlock it and reset it to zero after a timekeeping register is written to. the rtc registers can be written using the following 8052 assembly code: mov kyreg,#0eah mov intpr,#080h
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 122 of 1 52 table 128. rtc configuration sfr (timecon, address 0xa1) bit mnemonic default description 7 midnight 0 midnight flag. this bit is set when the rtc rolls over to 00:00:00:00. it can be cleared by the user to indicate that the midnight event has been serviced . in twenty-four hour mode, the midnight flag is raised once a day at midnight. when this interrupt is used for wake-up from psm2 to psm1 mode, the rtc interrupt must be serviced and the flag cleared to be allowed to enter psm2 mode. 6 tfh 0 twenty-four hour mode. this bit is retained during a watc hdog reset or an external reset. it is reset after a power-on reset (por). tfh result 0 256-hour mode. the hour register rolls over from 255 to 0. 1 24-hour mode. the hour register rolls over from 23 to 0. [5:4] its 0 interval timer time base selection. its result (time base) 00 1/128 sec. 01 second. 10 minute. 11 hour. 3 sit 0 interval timer 1 alarm. sit result 0 the alarm flag is set after intval counts, and then another interval count starts. 1 the alarm flag is set after one time interval. 2 alarm 0 interval timer alarm flag. this bit is set when the conf igured time interval has elapsed. it can be cleared by the user to indicate that the alarm event has been serviced. this bit cannot be set to 1 by user code. 1 iten 0 interval timer enable. iten result 0 the interval timer is disabled. the 8-bit interval timer counter is reset. 1 set this bit to enable the interval timer. 0 reserved 1 this bit must be left set for proper operation. table 129. hundredths of a second counter sfr (hthsec, address 0xa2) bit mnemonic default description [7:0] hthsec 0 this counter updates every 1/128 second, referenced from the calibrated 32.768 khz clock. it overflows from 127 to 00, incrementing the seconds counter (sec ). this register is retained during a watchdog reset or an external reset. it is reset after a por. table 130. seconds counter sfr (sec, address 0xa3) bit mnemonic default description [7:0] sec 0 this counter updates every second, referenced from the calibrated 32.768 khz clock. it overflows from 59 to 00, incrementing the minutes counter (min). this regi ster is retained during a watchdog reset or an external reset. it is reset after a por. table 131. minutes counter sfr (min, address 0xa4) bit mnemonic default description [7:0] min 0 this counter updates every minute, referenced from the calibrated 32.768 khz clock. it overflows from 59 to 00, incrementing the hours counter, hour. this regi ster is retained during a watchdog reset or an external reset. it is reset after a por. table 132. hours counter sfr (hour, address 0xa5) bit mnemonic default description [7:0] hour 0 this counter updates every hour, referenced from the calibrated 32.768 khz clock. if the tfh bit in the rtc configuration sfr (timecon, 0xa1) is set, the hour sfr overflows from 23 to 00, setting the midnight bit and creating a pending rtc interrupt. if the tfh bit is cleared, the hour sfr overflows from 255 to 00, setting the midnight bit and creating a pending rtc interrupt. this register is retained during a watchdog reset or an external reset. it is reset after a por.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 123 of 1 52 table 133. rtc alarm interval sfr (intval, address 0xa6) bit mnemonic default description [7:0] intval 0 the interval timer counts according to the time base established in the its bits of the rtc configuration sfr (timecon, 0xa1). when the number of counts is equal to intval, the alarm flag is set and a pending rtc interrupt is created. note that the interval counter is eight bits. therefore, it can count up to 255 seconds, for example. table 134. rtc nominal compensati on sfr (rtccomp, address 0xf6) bit mnemonic default description [7:0] rtccomp 0 holds the nominal rtc compensation value at 25c. this register is retained during a watchdog reset or an external reset. it is reset after a por. table 135. rtc temperature compensation sfr (tempcal, address 0xf7) bit mnemonic default description [7:0] tempcal 0 the tempcal sfr is adjusted based on the tempera ture read in the tempadc sfr to calibrate the rtc over temperature. this allows the external crysta l shift to be compensated over temperature. this register is retained during a watchdog reset or an external reset. it is reset after a por. table 136. interrupt pins configuration sfr (intpr, address 0xff) bit mnemonic default description 7 rtccal 0 controls the rtc calibration output. when set, the rtc calibration frequency selected by the fsel bits is output on the p0.2/cf1/rtccal pin. [6:5] fsel sets rtc calibration outp ut frequency and calibration window. fsel result (calibration window, frequency) 0 0 30.5 sec, 1 hz 0 1 30.5 sec, 512 hz 1 0 0.244 sec, 500 hz 1 1 0.244 sec, 16 khz 4 reserved [3:1] int1prg 000 controls the function of the int1 pin. int1prg result x 0 0 gpio x 0 1 bctrl 0 1 x int1 input disabled 1 1 x int1 input enabled 0 int0prg 0 controls the function of the int0 pin. int0prg result 0 int0 input disabled 1 int0 input enabled table 137. key sfr (kyreg, address 0xc1) bit mnemonic default description [7:0] kyreg 0 write 0xa7 to this sfr before writing to the powcon sfr, which unlocks kyreg. write 0xea to this sfr before writing to the intpr, hthsec, sec, min, or hour timekeeping registers to unlock kyreg.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 124 of 1 52 read and write operations writing to the rtc registers the rtc circuitry runs off a 32.768 khz clock. the timekeeping registers, the hundredths of a second counter sfr (hthsec, address 0xa2), seconds counter sfr (sec, address 0xa3), minutes counter sfr (min, address 0xa4), and hours counter sfr (hour, address 0xa5), are updated with a 32.768 khz clock. however, the rtc configuration sfr (timecon, address 0xa1) and alarm interval sfr (intval, address 0xa6) are updated with a 128 hz clock. it takes up to two 128 hz clock cycles from when the mcu writes to the timecon sfr or intval sfr until there is a successful update in the rtc. to protect the rtc timekeeping registers from runaway code, a key must be written to the key sfr (kyreg, address 0xc1), which is described in table 126 , to obtain write access to the hthsec, sec, min and hour sfrs. kyreg should be set to 0xea to unlock the timekeeping registers and reset to 0 after a timekeeping register is written to. the rtc registers can be written to using the following 8052 assembly code: mov rtckey,#0eah call updatertc ? updatertc: mov kyreg,rtckey mov sec,#30 mov kyreg,rtckey mov min,#05 mov kyreg,rtckey mov hour,#04 mov kyreg,#00h ret reading the rtc counter sfrs the rtc cannot be stopped to read the current time because stopping the rtc introduces an error in its timekeeping. therefore, the rtc is read on the fly, and the counter registers must be checked for overflow. this can be accomplished through the following 8052 assembly code: readagain: mov r0,hthsec ; using bank 0 mov r1,sec mov r2,min mov r3,hour mov a,hthsec cjne a, 00h, readagain ; 00h is r0 in bank 0 rtc modes the rtc can be configured in a 24-hour mode or a 256-hour mode. a midnight event is generated when the rtc hour counter rolls over from 23 to 0 or 255 to 0, depending on whether the tfh bit is set in the rtc configuration sfr (timecon, address 0xa1). the midnight event sets the midnight flag in the timecon sfr, and a pending rtc interrupt is created. the rtc midnight event wakes the 8052 mcu core if the mcu is asleep in psm2 mode when the midnight event occurs. in the 24-hour mode, the midnight event is generated once a day at midnight. the 24-hour mode is useful for updating a software calendar to keep track of the current day. the 256-hour mode results in power savings during extended operation in psm2 mode because the mcu core wakes up less frequently. rtc interrupts the rtc midnight interrupt and alarm interrupt are enabled by setting the eti bit in the interrupt enable and priority 2 sfr (ieip2, address 0xa9). when a midnight or alarm event occurs, a pending rtc interrupt is generated. if the rtc interrupt is enabled, the program vectors to the rtc interrupt address and the pending interrupt are cleared. if the rtc interrupt is disabled, the rtc interrupt remains pending until the rtc interrupt is enabled. the program then vectors to the rtc interrupt address. the midnight flag and alarm flag are set when the midnight event and alarm event occur, respectively. the user should manage these flags to keep track of which event caused an rtc interrupt by servicing the event and clearing the appropriate flag in the rtc interrupt servicing routine. note that if the ADE7116/ade7156/ade7166/ade7169/ ade7566/ade7569 are awakened by an rtc event, either by the midnight event or an alarm event, the pending rtc interrupt must be serviced before the device can go back to sleep again. the ADE7116/ade7156/ade7166/ade7169/ ade7566/ade7569 keep waking up until this interrupt has been serviced. i nterval timer alarm t he rtc can be used as an interval timer. when the interval timer is enabled by setting the iten bit in the rtc configuration sfr (timecon, address 0xa1), the interval timer clock source selected by the its1 and its0 bits is passed through an 8-bit counter. this counter increments on every interval timer clock pulse until it is equal to the value in the alarm interval sfr (intval, address 0xa6). then, an alarm event is generated, setting the alarm flag and creating a pending rtc interrupt. if the sit bit in the rtc configuration sfr (timecon, address 0xa1) is cleared, the 8-bit counter is cleared and starts counting again. if the sit bit is set, the 8-bit counter is held in reset after the alarm occurs.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 125 of 1 52 t ake care when changing the interval timer time base. the recommended procedure is as follows: 1. if the alarm interval sfr (intval, address 0xa6) is going to be modified, write to this register first. then, wait for one 128 hz clock cycle to synchronize with the rtc, 64,000 cycles at a 4.096 mhz instruction cycle clock. 2. disable the interval timer by clearing the iten bit in the rtc configuration sfr (timecon, address 0xa1). then, wait for one 128 hz clock cycle to synchronize with the rtc, 64,000 cycles at a 4.096 mhz instruction cycle clock. 3. read the timecon sfr to ensure that the iten bit is clear. if it is not, wait for another 128 hz clock cycle. 4. set the time-base bits (its) in the timecon sfr to configure the interval. wait for a 128 hz clock cycle for this change to take effect. the rtc alarm event wakes the 8052 mcu core if the mcu is in psm2 mode when the alarm event occurs. rtc calibration the rtc provides registers to compensate for the tolerance of the crystal frequency and its variation over temperature. up to 248 ppm frequency error can be calibrated with the rtc circuitry. the compensation is fully digital and implemented by adding or subtracting pulses from the crystal clock signal. the resolution of the rtc nominal compensation sfr (rtccomp, address 0xf6) is 2 ppm/lsb or 0.17 sec/day/lsb. the rtc compensation circuitry adds the rtc temperature compensation sfr (tempcal, address 0xf7) and the rtc nominal compensation sfr (rtccomp, address 0xf6) to determine how much compensation is required. the sum of these two registers is limited to 248 ppm or 42.85 sec/day. calibrating the rtc the nominal crystal frequency can be calibrated by adjusting the rtccomp sfr so that the clock going into the rtc is precisely 32.768 khz at 25c. calibration flow an rtc calibration pulse output is provided on the p0.2/cf1/ rtccal pin. enable the rtc output by setting the rtccal bit in the interrupt pins configuration sfr (intpr, address 0xff). the rtc calibration is accurate to within 2 ppm over a 30.5 sec window in all operational modes: psm0, psm1, and psm2. two output frequencies are offered for the normal rtc mode: 1 hz with fsel = 00 and 512 hz with fsel = 01 in the interrupt pins configuration sfr (intpr, address 0xff). a shorter window of 0.244 sec is offered for fast calibration during psm0 or psm1 mode. two output frequencies are offered for this rtc calibration output mode: 500 hz with fsel = 10 and 16 khz with fsel = 11 in the intpr sfr. note that for the 0.244 second calibration window, the rtc is clocked 125 times faster than in normal mode, resulting in timekeeping registers that represent seconds/125, minutes/125, and hours/125 instead of seconds, minutes, and hours. therefore, this mode should be used for calibration only. table 138. rtc calibration options option fsel calibration window (sec) f rtccal (hz) normal mode 0 00 30.5 1 normal mode 1 01 30.5 512 calibration mode 0 10 0.244 500 calibration mode 1 11 0.244 16,000 when no rtc compensation is applied, rtccomp and tempcal are equal to zero, the nominal compensation required to account for the error in the external crystal can be determined. in this case, it is not necessary to wait for an entire calibration window to determine the error in the pulse output. calculating at the error in frequency between two consecutive pulses on the p0.2/cf1/rtccal pin is sufficient. the value to write to the rtccomp sfr is calculated from the % error or seconds per day error on the frequency output. each lsb of the rtccomp sfr represents 2 ppm of correction where 1 sec/day error is equal to 11.57 ppm. )(%5000 error rtccomp = ) ( 57.112 1 error sec/day rtccomp = during calibration, user software writes the current time. refer to the read and write operations section for more information on how to read and write to the rtc timekeeping registers.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 126 of 1 52 ua rt serial interface th e ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 uart can be configured in one of four modes. ? s hift register with baud rate fixed at f core /12 ? 8-bit uart with variable baud rate ? 9-bit uart with baud rate fixed at f core /64 or f core /32 ? 9-bit uart with variable baud rate variable baud rates are defined by using an internal timer to generate any rate between 300 bauds/sec and 115,200 bauds/sec. the uart serial interface provided in the ade7166/ade7169/ ade7566/ade7569 is a full-duplex serial interface. it is also receive buffered by storing the first received byte in a receive buffer until the reception of the second byte is complete. the physical interface to the uart is provided via the rxd (p1.0/rxd) and txd (p1.1/txd) pins, and the firmware interface is through the sfrs presented in table 139 . both the serial port receive and transmit registers are accessed through the serial port buffer sfr (sbuf, address 0x99). writing to sbuf loads the transmit register, and reading sbuf accesses a physically separate receive register. an enhanced uart mode is offered by using the uart timer and by providing enhanced frame error, break error, and overwrite error detection. this mode is enabled by setting the exten bit in the configuration sfr (cfg, address 0xaf). see the uart additional features section. the enhanced serial baud rate control sfr (sbaudt, address 0x9e) and uart timer fractional divider sfr (sbaudf, address 0x9d) are used to configure the uart timer and to indicate the enhanced uart errors. uart sfrs table 139. serial port sfrs sfr address bit addressable description scon 0x98 yes serial communications control (see table 140 ). sbuf 0x99 no serial port buffer (see table 141 ). sbaudt 0x9e no enhanced serial baud rate control (see table 142 ). sbaudf 0x9d no uart timer fractional divider (see table 143 ). table 140. serial communications control sfr (scon, address 0x98) bit bit address mnemonic default description [7:6] 0x9f, 0x9e sm0, sm1 00 uart serial mode select bits. these bits select the serial port operating mode. sm0, sm1 result (selected operating mode) 00 mode 0, shift register, fixed baud rate (f core /12). 01 mode 1, 8-bit uart, variable baud rate. 10 mode 2, 9-bit uart, fixed baud rate (f core /32) or (f core /16). 11 mode 3, 9-bit uart, variable baud rate. 5 0x9d sm2 0 multiprocessor communication enable bit. enables multiprocessor communication in mode 2 and mode 3 and framing error detection in mode 1. in mode 0, sm2 should be cleared. in mode 1, if sm2 is set, ri is not activated if a valid stop bit was not received. if sm2 is cleared, ri is set as soon as the byte of data is received. in mode 2 or mode 3, if sm2 is set, ri is not ac tivated if the received nint h data bit in rb8 is 0. if sm2 is cleared, ri is set as soon as the byte of data is received. 4 0x9c ren 0 serial port receive enable bit. set by user software to enable serial port reception. cleared by user software to disable serial port reception. 3 0x9b tb8 0 serial port transmit (bit 9). the data loaded in to tb8 is the ninth data bit transmitted in mode 2 and mode 3. 2 0x9a rb8 0 serial port receiver (bit 9). the ninth data bi t received in mode 2 and mode 3 is latched into rb8. for mode 1, the stop bit is latched into rb8. 1 0x99 ti 0 serial port transmit interrupt flag. set by hardwa re at the end of the eighth bit in mode 0 or at the beginning of the stop bit in mode 1, mode 2, and mode 3. ti must be cleared by user software. 0 0x98 ri 0 serial port receive interrupt flag. set by hardware at the end of the eighth bit in mode 0 or halfway through the stop bit in mode 1, mode 2, and mode 3. ri must be cleared by user software.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 127 of 152 table 141. serial port buffer sfr (sbuf, address 0x99) bit mnemonic default description [7:0] sbuf 0 serial port data buffer. table 142. enhanced serial baud rate control sfr (sbaudt, address 0x9e) bit mnemonic default description 7 owe 0 overwrite error. this bit is set when new data is re ceived and ri = 1 (bit 0 in the scon sfr, address 0x98). it indicates that sbuf was not read before the next character was transferred in, causing the prior sbuf data to be lost. writ e a 0 to this bit to clear it. 6 fe 0 frame error. this bit is set when the received fram e does not have a valid stop bit. this bit is read only and updated every time a frame is received. 5 be 0 break error. this bit is set whenever the receive data line (rx) is low for longer than a full transmission frame, which is the time required for a start bit, eight data bits, a parity bit, and half a stop bit. this bit is updated every time a frame is received. [4:3] sbth 0 extended divider ratio for baud rate setting as shown in table 144 . [2:0] div 0 binary divider. see table 144 . div[2:0] result 000 divide by 1. 001 divide by 2. 010 divide by 4. 011 divide by 8. 100 divide by 16. 101 divide by 32. 110 divide by 64. 111 divide by 128. table 143. uart timer fractional divider sfr (sbaudf, address 0x9d) bit mnemonic default description 7 uartbauden 0 uart baud rate enable. set to enable uart timer to generate the baud rate. when set, the smod bit (pcon[7]), the tclk bit (t2con[4]), and the rclk bit (t2con[5]) are ignored. cleared to let the baud rate be generated as per a standard 8052. 6 not implemented, write dont care. [5:0] sbaudf 0 uart timer fractional divider bit 5.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 128 of 1 52 table 144. common baud rates using uart timer with a 4.096 mhz pll clock ideal baud cd sbth div sbaudt sbaudf % error 115,200 0 0 1 0x01 0x87 +0.16 115,200 1 0 0 0x00 0x87 +0.16 57,600 0 0 2 0x02 0x87 +0.16 57,600 1 0 1 0x01 0x87 +0.16 38,400 0 0 2 0x02 0xab ?0.31 38,400 1 0 1 0x01 0xab ?0.31 38,400 2 0 0 0x00 0xab ?0.31 19,200 0 0 3 0x03 0xab ?0.31 19,200 1 0 2 0x02 0xab ?0.31 19,200 2 0 1 0x01 0xab ?0.31 19,200 3 0 0 0x00 0xab ?0.31 9600 0 0 4 0x04 0xab ?0.31 9600 1 0 3 0x03 0xab ?0.31 9600 2 0 2 0x02 0xab ?0.31 9600 3 0 1 0x01 0xab ?0.31 9600 4 0 0 0x00 0xab ?0.31 4800 0 0 5 0x05 0xab ?0.31 4800 1 0 4 0x04 0xab ?0.31 4800 2 0 3 0x03 0xab ?0.31 4800 3 0 2 0x02 0xab ?0.31 4800 4 0 1 0x01 0xab ?0.31 4800 5 0 0 0x00 0xab ?0.31 2400 0 0 6 0x06 0xab ?0.31 2400 1 0 5 0x05 0xab ?0.31 2400 2 0 4 0x04 0xab ?0.31 2400 3 0 3 0x03 0xab ?0.31 2400 4 0 2 0x02 0xab ?0.31 2400 5 0 1 0x01 0xab ?0.31 2400 6 0 0 0x00 0xab ?0.31 300 0 2 7 0x17 0xab ?0.31 300 1 1 7 0x0f 0xab ?0.31 300 2 0 7 0x07 0xab ?0.31 300 3 0 6 0x06 0xab ?0.31 300 4 0 5 0x05 0xab ?0.31 300 5 0 4 0x04 0xab ?0.31 300 6 0 3 0x03 0xab ?0.31 300 7 0 2 0x02 0xab ?0.31
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 129 of 152 uart operation modes mode 0 (shift register wi th baud rate fixed at f core /12) mode 0 is selected when the sm0 and sm1 bits in the serial communications control register sfr (scon, address 0x98) are cleared. in this shift register mode, serial data enters and exits through the rxd pin. txd outputs the shift clock. the baud rate is fixed at f core /12. eight data bits are transmitted or received. transmission is initiated by any instruction that writes to the serial port buffer sfr (sbuf, address 0x99). the data is shifted out of the rxd line. the eight bits are transmitted with the least significant bit (lsb) first. reception is initiated when the serial port receive enable bit (ren, bit 4) is 1 and the serial port receive interrupt bit (ri, bit 0) is 0. when ri is cleared, the data is clocked into the rxd line, and the clock pulses are output from the txd line as shown in figure 104 . rxd (data out) txd (shift clock) data bit 0 data bit 1 data bit 6 data bit 7 06353-078 figure 104. 8-bit shift register mode mode 1 (8-bit uart, variable baud rate) mode 1 is selected by clearing sm0 (bit 7) and setting sm1 (bit 6). each data byte (lsb first) is preceded by a start bit (0) and followed by a stop bit (1). therefore, each frame consists of 10 bits transmitted on the txd pin or received on the rxd pin. the baud rate is set by a timer overflow rate. timer 1 or timer 2 can be used to generate baud rates, or both timers can be used simultaneously where one generates the transmit rate and the other generates the receive rate. there is also a dedicated timer for baud rate generation, the uart timer, which has a fractional divisor to precisely generate any baud rate (see the uart timer generated baud rates section). transmission is initiated by a write to the serial port buffer sfr (sbuf, address 0x99). next, a stop bit (1) is loaded into the ninth bit position of the interval serial port shift register. the data is output bit-by-bit until the stop bit appears on txd and the transmit interrupt flag (ti) is automatically set as shown in figure 105 . txd ti (scon.1) start bit d0 d1 d2 d3 d4 d5 d6 d7 stop bit set interrupt (for example, ready for more data) 06353-079 f igure 105. 8-bit variable baud rate r eception is initiated when a 1-to-0 transition is detected on the rxd pin. assuming that a valid start bit is detected, character reception continues. the eight data bits are clocked into the serial port shift register. all of the following conditions must be met at the time the final shift pulse is generated to receive a character: ? if the extended uart is disabled (exten = 0 in the cfg sfr, address 0xaf)), ri must be 0 to receive a character. this ensures that the data in the sbuf sfr is not overwritten if the last received character has not been read. ? if frame error checking is enabled by setting sm2, the received stop bit must be set to receive a character. this ensures that every character received comes from a valid frame, with both a start bit and a stop bit. i f any of these conditions is not met, the received frame is irretrievably lost, and the receive interrupt flag (ri) is not set. i f the received frame has met these conditions, the following events occur: ? the eight bits in the receive shift register are latched into the sbuf sfr. ? the ninth bit (stop bit) is clocked into rb8 in the scon sfr. ? the receiver interrupt flag (ri) is set. mode 2 (9-bit uart with baud fixed at f core /64 or f core /32) mode 2 is selected by setting sm0 and clearing sm1. in this mode, the uart operates in 9-bit mode with a fixed baud rate. the baud rate is fixed at f core /64 by default, although setting the smod bit in the program control sfr (pcon, address 0x87) doubles the frequency to f core /32. eleven bits are transmitted or received: a start bit (0), eight data bits, a programmable ninth bit, and a stop bit (1). the ninth bit is most often used as a parity bit or as part of a multiprocessor communication protocol, although it can be used for anything, including a ninth data bit, if required. t o use the ninth data bit as part of a communication protocol for a multiprocessor network such as rs-485, the ninth bit is set to indicate that the frame contains the address of the device with which the master wants to communicate. the devices on the network are always listening for a packet with the ninth bit set and are configured such that if the ninth bit is cleared, the frame is not valid, and a receive interrupt is not generated. if the ninth bit is set, all devices on the network receive the address and obtain a receive character interrupt. the devices examine the address and, if it matches one of the preprogrammed addresses of the devices, that device configures itself to listen to all incoming frames, even those with the ninth bit cleared. because the master has initiated communication with that device, all the following packets with the ninth bit cleared are intended specifically for that addressed device until another packet with the ninth bit set is received. if the address does not match, the device continues to listen for address packets.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 130 of 152 to transmit, the eight data bits must be written into the serial port buffer sfr (sbuf, address 0x99). the ninth bit must be written to tb8 (bit 3) in the serial communications control register bit description sfr (scon, 0x98). when transmission is initiated, the eight data bits from sbuf are loaded into the transmit shift register (lsb first). the ninth data bit, held in tb8, is loaded into the ninth bit position of the transmit shift register. the transmission starts at the next valid baud rate clock. the serial port transmit interrupt flag (ti, bit 1) is set as soon as the transmission completes, when the stop bit appears on txd. all of the following conditions must be met at the time the final shift pulse is generated to receive a character: ? if the extended uart is disabled (exten = 0 in the cfg sfr), ri must be 0 to receive a character. this ensures that the data in sbuf is not overwritten if the last received character has not been read. ? if multiprocessor communication is enabled by setting sm2, the received ninth bit must be set to receive a character. this ensures that only frames with the ninth bit set, which are frames that contain addresses, generate a receive interrupt. if any of these conditions is not met, the received frame is irretrievably lost, and the receive interrupt flag (ri) is not set. reception for mode 2 is similar to that of mode 1. the eight data bytes are input at the rxd pin (lsb first) and loaded onto the receive shift register. if the received frame has met the previous criteria, the following events occur: ? the eight bits in the receive shift register are latched into the sbuf sfr. ? the ninth data bit is latched into rb8 in the scon sfr. ? the receiver interrupt flag (ri) is set. mode 3 (9-bit uart with variable baud rate) mode 3 is selected by setting both sm0 and sm1. in this mode, the 8052 uart serial port operates in 9-bit mode with a variable baud rate. the baud rate is set by a timer overflow rate. timer 1 or timer 2 can be used to generate baud rates, or both timers can be used simultaneously where one generates the transmit rate and the other generates the receive rate. there is also a dedicated timer for baud rate generation, the uart timer, which has a fractional divisor to precisely generate any baud rate (see the uart timer generated baud rates section). the operation of the 9-bit uart is the same as for mode 2, but the baud rate can be varied. in all four modes, transmission is initiated by any instruction that uses sbuf as a destination register. reception is initiated in mode 0 when ri = 0 and ren = 1. reception is initiated in the other modes by the incoming start bit if ren = 1. uart baud rate generation mode 0 baud rate generation the baud rate in mode 0 is fixed. ? ? ? ? ? ? = 12 core f d rate mode 0 bau mode 2 baud rate generation the baud rate in mode 2 depends on the value of the pcon.7 (smod) bit in the program control sfr (pcon, 0x87). if smod = 0, the baud rate is 1/32 of the core clock. if smod = 1, the baud rate is 1/16 of the core clock. mode 2 baud rate = 32 2 smod f core mode 1 and mode 3 baud rate generation the baud rates in mode 1 and mode 3 are determined by the overflow rate of the timer generating the baud rate, that is, timer 1, timer 2, or the dedicated baud rate generator, uart timer, which has an integer and a fractional divisor. timer 1 generated baud rates when timer 1 is used as the baud rate generator, the baud rates in mode 1 and mode 3 are determined by the timer 1 overflow rate. the value of smod is as follows: mode 1 or mode 3 baud rate = 32 2 smod timer 1 overflow rate the timer 1 interrupt should be disabled in this application. the timer itself can be configured for either timer or counter operation and in any of its three running modes. in the most typical application, it is configured for timer operation in autoreload mode (high nibble of tmod = 0010 binary). in that case, the baud rate is given by the following formula: mode 1 or mode 3 baud rate = )256(32 2 th1 f core smod ? timer 2 generated baud rates baud rates can also be generated by using timer 2. using timer 2 is similar to using timer 1 in that the timer must overflow 16 times before a bit is transmitted or received. because timer 2 has a 16-bit autoreload mode, a wider range of baud rates is possible. mode 1 or mode 3 baud rate = 16 1 timer 2 overflow rate therefore, when timer 2 is used to generate baud rates, the timer increments every two clock cycles rather than every core machine cycle as before. it increments six times faster than timer 1, and, therefore, baud rates six times faster are possible.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 131 of 152 ) (1 + sbaudf/64) uart timer rx/tx clock f core uartbauden rx clock tx clock timer 1/timer 2 rx clock fractional divide r 0 0 1 1 timer 1/timer 2 tx clock 32 2 div + sbth 06353-081 because timer 2 has 16-bit autoreload capability, very low baud rates are still possible. timer 2 is selected as the baud rate generator by setting tclk and/or rclk in timer/counter 2 control sfr (t2con, address 0xc8). the baud rates for transmit and receive can be simultaneously different. setting rclk and/or tclk puts timer 2 into its baud rate generator mode, as shown in figure 107 . in this case, the baud rate is given by the following formula: mode 1 or mode 3 baud rate = figure 106. uart timer, uart baud rate () [] ( lrcaphrcap f core 2:2 6553616 ? two sfrs, enhanced serial baud rate control sfr (sbaudt, address 0x9e) and uart timer fractional divider sfr (sbaudf, address 0x9d), are used to control the uart timer. sbaudt is the baud rate control sfr; it sets up the integer divider (div) and the extended divider (sbth) for the uart timer. uart timer generated baud rates the high integer dividers in a uart block mean that high speed baud rates are not always possible. in addition, generating baud rates requires the exclusive use of a timer, rendering it unusable for other applications when the uart is required. to address this problem, each ADE7116/ade7156/ade7166/ade7169/ ade7566/ade7569 has a dedicated baud rate timer (uart timer) specifically for generating highly accurate baud rates. the uart timer can be used instead of timer 1 or timer 2 for gener- ating very accurate high speed uart baud rates, including 115,200 bps. this timer also allows a much wider range of baud rates to be obtained. in fact, every desired bit rate from 12 bps to 393,216 bps can be generated to within an error of 0.8%. the uart timer also frees up the other three timers, allowing them to be used for different applications. a block diagram of the uart timer is shown in figure 106 . the appropriate value to write to div (bits [2:0]) and sbth (bits [4:3]) bits can be calculated using the following formula where f core is defined in the powcon sfr (see tabl e 26 ). note that the div value must be rounded down to the nearest integer. () 2log 16 log ? ? ? ? ? ? ? ? =+ ratebaud f sbth div core f core t2 pin tr2 control tl2 (8 bits) th2 (8 bits) reload exen2 control t2ex pin transition detector exf 2 timer 2 interrupt rcap2l rcap2h timer 2 overflow 2 16 16 rclk tclk rx clock tx clock 0 0 1 1 10 smod timer 1 overflow c/ t2 = 0 c/ t2 = 1 note: availability of additional external interrupt 06353-080 figure 107. timer 2, uart baud rates
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 132 of 1 52 sbaudf is the fractional divider ratio required to achieve the required baud rate. the appropriate value for sbaudf can be calculated with the following formula: ? ? ? ? ? ? ? ? ? = + 1 216 64 ratebaud f sbaudf sbthdiv core note that sbaudf should be rounded to the nearest integer. after the values for div and sbaudf are calculated, the actual baud rate can be calculated with the following formula: ? ? ? ? ? ? + = + 64 1 216 sbaudf f ratebaudactual sbthdiv core for example, to obtain a baud rate of 9600 bps while operating at a core clock frequency of 4.096 mhz with the pll cd bits equal to 0, () 474.4 2log 960016 4,096,000 log == ? ? ? ? ? ? =+ sbth div note that the div result is rounded down. 0x2b67.421 9600216 000,096,4 64 3 == ? ? ? ? ? ? ? = sbaudf thus, the actual baud rate is 9570 bps, resulting in a 0.31% error. uart additional features enhanced error checking the extended uart provides frame error, break error, and over-write error detection. framing errors occur when a stop bit is not present at the end of the frame. a missing stop bit implies that the data in the frame may not have been received properly. break error detection indicates whether the rx line has been low for longer than a 9-bit frame. it indicates that the data just received, a 0 or null character, is not valid because the master has disconnected. overwrite error detection indicates when the received data has not been read fast enough and, as a result, a byte of data has been lost. the 8052 standard uart offers frame-error checking for an 8-bit uart through the sm2 and rb8 bits. setting the sm2 bit prevents frames without a stop bit from being received. the stop bit is latched into the rb8 bit in the serial communications control sfr (scon, address 0x98). this bit can be examined to determine if a valid frame was received. the 8052 does not, however, provide frame error checking for a 9-bit uart. this enhanced error checking functionality is available through the frame error bit, fe, in the enhanced serial baud rate control sfr (sbaudt, address 0x9e). the fe bit is set on framing errors for both 8-bit and 9-bit uarts. rx ri fe exten = 1 d7 d6 d5d4 d3 d2 d1 d0 stop start 06353-082 figure 108. uart timing in mode 1 rx ri fe exten = 1 d7 d6d5 d4 d3 d2d1d0 d8 stop start 06353-083 figure 109. uart timing in mode 2 and mode 3 the 8052 standard uart does no t provide break error detection. however, for an 8-bit uart, a break error can be detected when the received character is 0, a null character, and when there is no stop bit because the rb8 bit is low. break error detection is not possible for a 9-bit 8052 uart because the stop bit is not recorded. the ADE7116/ade7156/ade7166/ade7169/ ade7566/ade7569 enhanced break error detection is available through the be bit in the sbaudt sfr. the 8052 standard uart prevents overwrite errors by not allowing a character to be received when the ri, receive interrupt flag, is set. however, it does not indicate if a character has been lost because the ri bit is set when the frame is received. the enhanced uart overwrite error detection provides this infor- mation. when the enhanced 8052 uart is enabled, a frame is received regardless of the state of the ri flag. if ri = 1 when a new byte is received, the byte in scon is overwritten, and the overwrite error flag is set. the overwrite error flag is cleared when sbuf is read. the extended uart is enabled by setting the exten bit in the configuration sfr (cfg, address 0xaf). uart txd signal modulation there is an internal 38 khz signal that can be ored with the uart transmit signal for use in remote control applications (see the 38 khz modulation section). one of the events that can wake the mcu from sleep mode is activity on the rx pin (see the 3.3 v peripherals and wake-up events section).
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 133 of 152 serial peripheral interface (spi) the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 integrate a complete hardware serial peripheral interface on-chip. the spi is full duplex so that eight bits of data are synchronously transmitted and simultaneously received. this spi implementation is double buffered, allowing users to read the last byte of received data while a new byte is shifted in. the next byte to be transmitted can be loaded while the current byte is shifted out. the spi port can be configured for master or slave operation. the physical interface to the spi is via the miso (p0.5/miso), mosi (p0.4/mosi/sdata), sclk (p0.6/sclk/t0), and ss (p0.7/ ss /t1) pins, while the firmware interface is via the spi configuration sfr 1 (spimod1, address 0xe8), the spi configuration sfr 2 (spimod2, address 0xe9), the spi interrupt status sfr (spistat, address 0xea), the spi/i 2 c transmit buffer sfr (spi2ctx, address 0x9a), and the spi/i 2 c receive buffer sfr (spi2crx, address 0x9b). note that the spi pins are shared with the i 2 c pins. therefore, the user can enable only one interface at a time. the scps bit in the configuration sfr (cfg, address 0xaf) selects which peripheral is active. spi registers table 145. spi sfr list sfr address mnemonic r/w length (bits) default description 0x9a spi2ctx w 8 0 spi/i 2 c transmit buffer (see table 146 ). 0x9b spi2crx r 8 0 spi/i 2 c receive buffer (see table 147 ). 0xe8 spimod1 r/w 8 0x10 spi configuration sfr 1 (see table 148 ). 0xe9 spimod2 r/w 8 0 spi configuration sfr 2 (see table 149 ). 0xea spistat r/w 8 0 spi/i 2 c interrupt status (see table 150 ). table 146. spi/i 2 c transmit buffer sfr (spi2ctx, address 0x9a) bit mnemonic default description [7:0] spi2ctx 0 spi or i 2 c transmit buffer. when the spi2ctx sfr is writte n, its content is transferred to the transmit fifo input. when a write is requested, the fifo output is sent on the spi or i 2 c bus. table 147. spi/i 2 c receive buffer sfr (spi2crx, address 0x9b) bit mnemonic default description [7:0] spi2crx 0 spi or i 2 c receive buffer. when spi2crx sfr is read, one byte from the receive fifo output is transferred to spi2crx sfr. a new data byte from the spi or i 2 c bus is written to the fifo input.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 134 of 152 table 148. spi configuration sfr 1 (spimod1, address 0xe8) bit address mnemonic default description [7:6] 0xef to 0xee reserved 0 reserved. 5 0xed intmod 0 spi interrupt mode. intmod result 0 spi interrupt is set wh en the spi rx buffer is full. 1 spi interrupt is set when the spi tx buffer is empty. 4 0xec auto_ss 1 master mode, ss output control (see ). figure 110 auto_ss result 0 the ss pin is held low while this bit is clea red. this allows manual chip select control using the ss pin. 1 single byte read or write. the ss pin goes low during a single byte transmission and then returns high. continuous transfer. the ss pin goes low during the duration of the multibyte continuous transfer an d then returns high. 3 0xeb ss_en 0 slave mode, ss input enable. when this bit is set to logic 1, the ss pin is defined as the slave select input pin for the spi slave interface. 2 0xea rxofw 0 receive buffer overflow write enable. rxofw result 0 if the spi2crx sfr has not been read when a new data byte is received, the new byte is discarded. 1 if the spi2crx sfr has not been read when a new data byte is received, the new byte overwrites the old data. [1:0] 0xe9 to 0xe8 spir 0 master mode, spi sclk frequency. spir result 00 f core /8 = 512 khz (if f core = 4.096 mhz). 01 f core /16 = 256 khz (if f core = 4.096 mhz). 10 f core /32 = 128 khz (if f core = 4.096 mhz). 11 f core /64 = 64 khz (if f core = 4.096 mhz).
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 135 of 152 table 149. spi configuration sfr 2 (spimod2, address 0xe9) bit mnemonic default description 7 spicont 0 master mode, spi contin uous transfer mode enable bit. spicont result 0 the spi interface stops after one byte is transferred and ss is deasserted. a new data transfer can be initiated after a stalled period. 1 the spi interface continues to transfer data until no valid data is available in the spi2ctx sfr. ss remains asserted until the spi2ctx sfr and the transmit shift registers are empty. 6 spien 0 spi interface enable bit. spien result 0 the spi interface is disabled. 1 the spi interface is enabled. 5 spiodo 0 spi open-drain output configuration bit. spiodo result 0 internal pull-up resistors are connected to the spi outputs. 1 the spi outputs are open drain and need external pull-up resistors. the pull-up voltage should not exceed the specified operating voltage. 4 spims_b 0 spi master mode enable bit. spims_b result 0 the spi interface is defined as a slave. 1 the spi interface is defined as a master. 3 spicpol 0 spi clock polarity configuration bit (see figure 112 ). spicpol result 0 the default state of sclk is low, and the first sc lk edge is rising. depending on the spicpha bit, the spi data output changes state on the falling or rising edge of sclk whil e the spi data input is sampled on the rising or falling edge of sclk. 1 the default state of sclk is high, and the firs t sclk edge is falling. depending on the spicpha bit, the spi data output changes state on the risi ng or falling edge of sclk while the spi data input is sampled on the falling or rising edge of sclk. 2 spicpha 0 spi clock phase configuration bit (see figure 112 ). spicpha result 0 the spi data output changes state when ss goes low at the second edge of sclk and then every two subsequent edges, whereas the spi data inp ut is sampled at the firs t sclk edge and then every two subsequent edges. 1 the spi data output changes state at the first edge of sclk and then every two subsequent edges, whereas the spi data input is sampled at the second sclk edge and then every two subsequent edges. 1 spilsbf 0 master mode, lsb first configuration bit. spilsbf result 0 the msb of the spi outputs is transmitted first. 1 the lsb of the spi outputs is transmitted first. 0 timode 1 transfer and interrupt mode of the spi interface. timode result 1 this bit must be set to 1 for proper operation.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 136 of 152 table 150. spi interrupt status sfr (spistat, address 0xea) bit mnemonic default description 7 busy 0 spi peripheral busy flag. busy result 0 the spi peripheral is idle. 1 the spi peripheral is bu sy transferring data in slave or master mode. 6 mmerr 0 spi multimaster error flag. mmerr result 0 a multiple master error has not occurred. 1 if the ss_en bit (spimod1, address 0xe8) is set, enabling the slave select input and asserting the ss pin while the spi peripheral is transfe rring data as a master, this flag is raised to indicate the error. write a 0 to this bit to clear it. 5 spirxof 0 spi receive overflow error flag. reading the spi2crx sfr clears this bit. spirxof timode result 0 x the spi2crx sfr (address 0x9b) contains valid data. 1 1 this bit is set if the spi2crx sfr is not read before the end of the next byte transfer. if the rxofw bit (spimod1, address 0xf8) is set and this condition occurs, spi2crx is overwritten. 4 spirxirq 0 spi receive mode interrupt flag . reading the spi2crx sfr clears this bit. spirxirq timode result 0 x the spi2crx register does not contain new data. 1 0 this bit is set when the spi2crx register contains new data. if the spi/i 2 c interrupt is enabled, an inte rrupt is generated when this bit is set. if the spi2crx register is not read before the end of th e current byte transfer, the transfer stops and the ss pin is deasserted. 1 1 the spi2crx register contains new data. 3 spirxbf 0 status bit for spi rx buffer. when set, the rx fifo is full. a read of th e spi2crx clears this flag. 2 spitxuf 0 status bit for spi tx buffer. when set, the tx fifo is underflowing and data can be written into spi2ctx (address 0x9a). write a 0 to this bit to clear it. 1 spitxirq 0 spi transmit mode interrupt flag. writ ing new data to the spi2ctx sfr clears this bit. spitxirq timode result 0 x the spi2ctx sfr is full. 1 0 the spi2ctx sfr is empty. 1 1 this bit is set when the spi2ctx sfr is empty. if the spi/i 2 c interrupt is enabled, an interrupt is generated when this bit is set. if new data is not written into the spi2ctx sfr before the end of the current byte transfer, the transfer stops, and the ss pin is deasserted. write a 0 to this bit to clear it. 0 spitxbf 0 status bit for the spi tx buffer. when set, the spi tx buffer is full. write a 0 to this bit to clear it. spi pins miso (master in, slave out data i/o pin) the miso (p0.5/miso) pin is configured as an input line in master mode and as an output line in slave mode. the miso line on the master (data in) should be connected to the miso line in the slave device (data out). the data is transferred as byte-wide (8-bit) serial data, msb first. mosi (master out, slave in pin) the mosi (p0.4/mosi/sdata) pin is configured as an output line in master mode and as an input line in slave mode. the mosi line on the master (data out) should be connected to the mosi line in the slave device (data in).the data is transferred as byte-wide (8-bit) serial data, msb first. sclk (serial clock i/o pin) the master serial clock (sclk) is used to synchronize the data being transmitted and received through the mosi and miso data lines. the sclk (p0.6/sclk/t0) pin is configured as an output in master mode and as an input in slave mode. in master mode, the bit rate, polarity, and phase of the clock are controlled by the spi configuration sfr 1 (spimod1, address 0xe8) and spi configuration sfr 2 (spimod2, address 0xe9). in slave mode, the spi conf iguration sfr 2 (spimod2, address 0xe9) must be configured with the phase and polarity of the expected input clock.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 137 of 152 in both master and slave modes, the data is transmitted on one edge of the sclk signal and sampled on the other. it is important, therefore, that the spicpha and spicpol bits be configured the same for the master and slave devices. ss (slave select pin) in spi slave mode, a transfer is initiated by the assertion of ss low. the spi port then transmits and receives 8-bit data until the data is concluded by the deassertion of ss according to the spicon bit setting. in slave mode, ss is always an input. in spi master mode, the ss (p0.7/t1) can be used to control data transfer to a slave device. in the automatic slave select control mode, the ss is asserted low to select the slave device and then raised to deselect the slave device after the transfer is complete. automatic slave select control is enabled by setting the auto_ss bit in the spi configuration sfr 1 (spimod1, address 0xe8). in a multimaster system, the ss can be configured as an input so that the spi peripheral can operate as a slave in some situations and as a master in others. in this case, the slave selects for the slaves controlled by this spi peripheral should be generated with general i/o pins. spi master operating modes the double buffered receive and transmit registers can be used to maximize the throughput of the spi peripheral by continuously streaming out data in master mode. the continuous transmit mode is designed to use the full capacity of the spi. in this mode, the master transmits and receives data until the spi/i 2 c transmit buffer sfr (spi2ctx, address 0x9a) is empty at the start of a byte transfer. continuous mode is enabled by setting the spicont bit (bit 7) in the spi configuration sfr 2 (spimod2, address 0xe9). the spi peripheral also offers a single byte read/write function. in master mode, the type of transfer is handled automatically, depending on the configuration of the spicont bit in the spi configuration sfr 2 (spimod2, 0xe9). the following procedures show the sequence of events that should be performed for each master operating mode. based on the ss configuration, some of these events take place automatically. procedures for using spi as a master single byte write mode, spicont (spimod2[7]) = 0 1. wr ite to t he spi2ctx sfr . 2. ss is asserted low, and a write routine is initiated. 3. the spitxirq interrupt flag is set when the spi2ctx register is empty. 4. ss is deasserted high. 5. write to spi2ctx sfr to clear the spitxirq interrupt flag. 6. write to spi2ctx sfr to clear the spitxirq interrupt flag. continuous mode, spicont (spimod2[7]) = 1 1. write to the spi2ctx sfr. 2. ss is asserted low, and a write routine is initiated. 3. wait for the spitxirq interrupt flag to write to spi2ctx sfr. 4. transfer continues until the spi2ctx register and transmit shift registers are empty. 5. the spitxirq interrupt flag is set when the spi2ctx register is empty. 6. ss is deasserted high. 7. write to spi2ctx sfr to clear the spitxirq interrupt flag. figure 110 shows the spi output for certain automatic chip select and continuous mode selections. note that if the continuous mode is not used, a short delay is inserted between transfers. sclk ss dout din din1 din2 auto_ss = 1 spicont = 0 sclk ss dout din din1 auto_ss = 1 spicont = 1 din2 auto_ss = 0 spicont = 0 (manual ss control) dout1 dout2 dout1 dout2 sclk ss dout din din1 din2 dout1 dout2 06353-084 figure 110. automatic chip select and continuous mode output note that reading the content of the spi/i 2 c receive buffer sfr (spi2crx, address 0x9b) should be done using a 2-cycle instruction set such as mov a or spi2crx. using a 3-cycle instruction such as mov 0x3d or spi2crx does not transfer the right information into the target register.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 138 of 152 spi interrupt and status flags the spi interface has several status flags that indicate the status of the double-buffered receive and transmit registers. figure 111 shows when the status and interrupt flags are raised. the transmit interrupt occurs when the internal serial port shift register is loaded with the data in the spi/i2c transmit buffer sfr (spi2ctx, address 0x9a) register. if the spi master is in transmit operating mode, and the spi/i 2 c transmit buffer sfr (spi2ctx, address 0x9a) register has not been written with new data by the beginning of the next byte transfer, the transmit operation stops. when a new byte of data is received in the spi/i 2 c receive buffer sfr (spi2crx, address 0x9b), the spi receive interrupt flag is raised. if the data in the spi/i 2 c receive buffer sfr (spi2crx, address 0x9b) is not read before new data is ready to be loaded into the spi/i 2 c receive buffer sfr (spi2crx, address 0x9b), an overflow condition has occurred. this overflow condition, indicated by the spirxof flag, forces the new data to be discarded or overwritten if the rxofw bit (spimod1, address 0xe8) is set. spitx transmit shift register spitxirq = 1 spitx (empty) transmit shift register stops transfer if timode = 1 spirx receive shift register spirxirq = 1 spirx (full) receive shift register spirxof = 1 06353-085 figure 111. spi receive and transmit interrupt and status flags sclk (spicpol=0) miso sclk (spicpol = 1) mosi spirx1 and spitx1 flags ss_b spirx0 and spitx0 flags spicpha = 1 msb bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 lsb ? msb bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 lsb ? msb bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 lsb ? msb bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 lsb ? miso mosi spirx1 and spitx1 flags spirx0 and spitx0 flags s picpha = 0 06353-086 figure 112. spi timi ng configurations
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 139 of 1 52 i 2 c-compatible interface the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 support a fully licensed i 2 c interface. the i 2 c interface is implemented as a full hardware master. sdata (p0.4/mosi/sdata) is the data i/o pin, and sclk (p0.6/sclk/t0) is the serial clock. these two pins are shared with the mosi and sclk pins of the on-chip spi interface. therefore, the user can enable only one interface or the other on these pins at any given time. the scps bit (bit 5) in the configuration sfr (cfg, address 0xaf) selects which peripheral is active. the two pins used for data transfer, sdata and sclk, are configured in a wire-and format that allows arbitration in a multimaster system. the transfer sequence of an i 2 c system consists of a master device initiating a transfer by generating a start condition while the bus is idle. the master transmits the address of the slave device and the direction of the data transfer in the initial address transfer. if the slave acknowledges, the data transfer is initiated. this continues until the master issues a stop condition and the bus becomes idle. serial clock generation the i 2 c master in the system generates the serial clock for a transfer. the master channel can be configured to operate in fast mode (256 khz) or standard mode (32 khz). the bit rate is defined in the i2cmod sfr as follows: ]0:1[2 216 cri core sclk f f = slave addresses the i 2 c slave address sfr (i2cadr, address 0xe9) contains the slave device id. the lsb of this register contains a read/write request. a write to this sfr starts the i 2 c communication. i 2 c registers the i 2 c peripheral interface consists of five sfrs: ? i 2cmod ? s pi2cstat ? i2cadr ? spi2ctx ? spi2crx because the spi and i 2 c serial interfaces share the same pins, they also share the same sfrs, such as the spi2ctx and spi2crx sfrs. in addition, the i2cmod, i2cadr, and spi2cstat, and spi2ctx sfrs are shared with the spimod1, spimod2, and spistat sfrs, respectively. table 151. i 2 c sfr list sfr address mnemonic r/w length default description 0x9a spi2ctx w 8 spi/i 2 c transmit buffer (see table 146 ). 0x9b spi2crx r 8 0 spi/i 2 c receive buffer (see table 147 ). 0xe8 i2cmod r/w 8 0 i 2 c mode (see table 152 ). 0xe9 i2cadr r/w 8 0 i 2 c slave address (see table 153 ). 0xea spi2cstat r/w 8 0 i 2 c interrupt status register (see table 154 ). table 152. i 2 c mode sfr (i2cmod, address 0xe8) bit bit address mnemonic default description 7 0xef i2cen 0 i 2 c enable bit. when this bit is set to logic 1, the i 2 c interface is enabled. a write to the i2cadr sfr starts a communication. [6:5] 0xee to 0xed i2cr 0 i 2 c sclk frequency. i2cr result 00 f core /16 = 256 khz if f core = 4.096 mhz. 01 f core /32 = 128 khz if f core = 4.096 mhz. 10 f core /64 = 64 khz if f core = 4.096 mhz. 11 f core /128 = 32 khz if f core = 4.096 mhz. [4:0] 0xec to 0xe8 i2crct 0 configures the length of the i 2 c received fifo buffer. the i 2 c peripheral stops when the i2crct bits + 1 byte have been read, or if an error occurs. table 153. i 2 c slave address sfr (i2cadr, address 0xe9) bit mnemonic default description [7:1] i2cslvadr 0 address of the i 2 c slave being addressed. writing to this register starts the i 2 c transmission (read or write). 0 i2cr_w 0 command bit for read or write. when this bit is se t to logic 1, a read command is transmitted on the i 2 c bus. data from the slave in the spi2crx sfr (address 0x9b) is expected after a command byte. when this bit is set to logic 0, a write command is transmitted on the i 2 c bus. data to slave is expected in the spi2ctx sfr.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 140 of 1 52 table 154. i 2 c interrupt status register sfr (spi2cstat, address 0xea) bit mnemonic default description 7 i2cbusy 0 this bit is set to logic 1 when the i 2 c interface is used. when set, the tx fifo is emptied. 6 i2cnoack 0 i 2 c no acknowledgement transmit interrupt. this bit is set to logic 1 when the slave device does not send an acknowledgement. the i 2 c communication is stopped after this event. write a 0 to this bit to clear it. 5 i2crxirq 0 i 2 c receive interrupt. this bit is set to logic 1 when the receive fifo is not empty. write a 0 to this bit to clear it. 4 i2ctxirq 0 i 2 c transmit interrupt. this bit is set to lo gic 1 when the transmit fifo is empty. write a 0 to this bit to clear it. [3:2] i2cfifostat 0 status bits for 3- or 4-bytes deep i 2 c fifo. the fifo monitored in these two bits is the one currently used in i 2 c communication (receive or transmit) because only one fifo is active at a time. i2cfifostat result 00 fifo empty 01 reserved 10 fifo half full 11 fifo full 1 i2cacc_err 0 set when trying to write and read at the same time. write a 0 to this bit to clear it. 0 i2ctxwr_err 0 set when a write was attempted when the i 2 c transmit fifo was full. write a 0 to this bit to clear it. read and write operations sclk sdata start by master ack by slave ack by master frame 2 data byte 1 from master frame 1 serial bus address byte 19 9 1 a0a1a2a3a4a5a6 r/w d0d1d2d3d4d5 d6 d7 9 1 d0d1d2d3d4d5d6d7 frame n + 1 data byte n from slave stop by master nack by master 0 6353-087 figure 113. i 2 c read operation sclk sdata start by master ack by slave ack by slave frame 2 data byte 1 from master frame 1 serial bus address byte 19 1 9 stop by master a0a1a2a3a4a5a6 r/w d0 d1d2d3 d4 d5d6d7 06353-088 figure 114. i 2 c write operation figure 113 and figure 114 depict i 2 c read and write operations, respectively. note that the lsb of the i2cadr sfr is used to select whether a read or write operation is performed on the slave device. during the read operation, the master acknowledges are generated automatically by the i 2 c peripheral. the master generated nack (no acknowledge) before the end of a read operation is also automatically generated after the i2crct bits have been read from the slave. if the i2cadr register is updated during a transmission, instead of generating a stop at the end of the read or write operation, the master generates a start condition and continues with the next communication. reading the spi/i 2 c receive buffer sfr (spi2crx, address 0x9b) reading the spi2crx sfr should be done with a 2-cycle instruction, such as mov a, spi2crx or mov r0, spi2crx. a 3-cycle instruction such as mov 3dh, spi2crx does not transfer the right data into ram address 0x3d.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 141 of 1 52 i 2 c receive and transmit fifos the i 2 c peripheral has a 4-byte receive fifo and a 4-byte transmit fifo. the buffers reduce the overhead associated with using the i 2 c peripheral. figure 115 shows the operation of the i 2 c receive and transmit fifos. the tx fifo can be loaded with four bytes to be transmitted to the slave at the beginning of a write operation. when the transmit fifo is empty, the i 2 c transmit interrupt flag is set, and the pc vectors to the i 2 c interrupt vector if this interrupt is enabled. if a new byte is not loaded into the tx fifo before it is needed in the transmit shift register, the communication stops. an error, such as not receiving an acknowledge, also causes the communication to terminate. in case of an error during a write operation, the tx fifo is flushed. the rx fifo allows four bytes to be read in from the slave before the mcu has to read the data. a receive interrupt can be generated after each byte is received or when the rx fifo is full. if the peripheral is reading from a slave address, the communication stops when the number of received bytes equals the number set in the i2crct bits. an error, such as not receiving an acknowledge, also causes the communication to terminate. i 2 ctx 4 byte fifo mov i 2 ctx, txdata1 mov i 2 ctx, txdata2 mov i 2 ctx, txdata3 mov i 2 ctx, txdata4 code to fill tx fifo: transmit shift register i 2 crx receive shift register 4 byte fifo code to read rx fifo: mov a, i 2 crx; result: a = rxdata1 mov a, i 2 crx; result: a = rxdata2 mov a, i 2 crx; result: a = rxdata3 mov a, i 2 crx; result: a = rxdata4 txdata1 txdata2 txdata3 txdata4 rxdata4 rxdata3 rxdata2 rxdata1 06353-089 figure 115. i 2 c fifo operation
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 142 of 1 52 i/o ports parallel i/o the ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 use three input/output ports to exchange data with external devices. in addition to performing general-purpose i/o, some are capable of driving an lcd or performing alternate functions for the peripherals available on-chip. in general, when a peripheral is enabled, the pins associated with it cannot be used as a general-purpose i/o. the i/o port can be configured through the sfrs listed in table 155 . table 155. i/o port sfrs sfr address bit addressable description p0 0x80 yes port 0 register. p1 0x90 yes port 1 register. p2 0xa0 yes port 2 register. epcfg 0x9f no extended port configuration. pinmap0 0xb2 no port 0 weak pull-up enable. pinmap1 0xb3 no port 1 weak pull-up enable. pinmap2 0xb4 no port 2 weak pull-up enable. the three bidirectional i/o ports have internal pull-ups that can be enabled or disabled individually for each pin. the internal pull-ups are enabled by default. disabling an internal pull-up causes a pin to become open drain. weak internal pull-ups are configured through the pinmapx sfrs. figure 116 shows a typical bit latch and i/o buffer for an i/o pin. the bit latch (one bit in the sfr of each port) is represented as a type d flip-flop, which clocks in a value from the internal bus in response to a write-to-latch signal from the cpu. the q output of the flip-flop is placed on the internal bus in response to a read latch signal from the cpu. the level of the port pin itself is placed on the internal bus in response to a read pin signal from the cpu. some instructions that read a port activate the read latch signal, and others activate the read pin signal. see the read-modify-write instructions section for details. read latch internal bus write to latch read pin d cl q latch dv dd px.x pin internal pull-up alternate output function alternate input function q closed: pinmapx.x = 0 open: pinmapx.x = 1 06353-090 figure 116. port 0 bit latch and i/o buffer weak internal pull-ups enabled a pin with weak internal pull-up enabled is used as an input by writing a 1 to the pin. the pin is pulled high by the internal pull- ups, and the pin is read using the circuitry shown in figure 116 . if the pin is driven low externally, it sources current because of the internal pull-ups. a pin with internal pull-up enabled is used as an output by writing a 1 or a 0 to the pin to control the level of the output. if a 0 is written to the pin, it drives a logic low output voltage (v ol ) and is capable of sinking 1.6 ma. open drain (weak internal pull-ups disabled) when the weak internal pull-up on a pin is disabled, the pin becomes open drain. use this open-drain pin as a high impedance input by writing a 1 to the pin. the pin is read using the circuitry shown in figure 116 . the open-drain option is preferable for inputs because it draws less current than the internal pull-ups that were enabled. 38 khz modulation every ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 provides a 38 khz modulation signal. the 38 khz modulation is accomplished by internally xoring the level written to the i/o pin with a 38 khz square wave. then, when a 0 is written to the i/o pin, it is modulated as shown in figure 117 . 38khz modulation signal output at mod38 pin level written to mod38 06353-091 figure 117. 38 khz modulation uses for this 38 khz modulation include ir modulation of a uart transmit signal or a low power signal to drive an led. the modulation can be enabled or disabled with the mod38en bit (bit 4) in the cfg sfr (address 0xaf). the 38 kh z modulation is available on eight pins, selected by the mod38[7:0] b its in the extended port configuration sfr (epcfg, address 0x9f).
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 143 of 1 52 i/o registers table 156. extended port configuration sfr (epcfg, address 0x9f) bit mnemonic default description 7 mod38_fp21 0 this bit enables 38 khz modulation on the p1.6/fp21 pin. 6 mod38_fp22 0 this bit enables 38 khz modulation on the p1.5/fp22 pin. 5 mod38_fp23 0 this bit enables 38 khz modulation on the p1.4/t2/fp23 pin. 4 mod38_txd 0 this bit enables 38 khz modulation on the p1.1/txd pin. 3 mod38_cf1 0 this bit enables 38 khz modulation on the p0.2/cf1/rtccal pin. 2 mod38_ssb 0 this bit enables 38 khz modulation on the p0.7/ ss /t1 pin. 1 mod38_miso 0 this bit enables 38 khz modulation on the p0.5/miso pin. 0 mod38_cf2 0 this bit enables 38 khz modulation on the p0.3/cf2 pin. table 157. port 0 weak pull-up enable sfr (pinmap0, address 0xb2) bit mnemonic default description 7 pinmap0.7 0 the weak pull-up on p0.7 is disabled when this bit is set. 6 pinmap0.6 0 the weak pull-up on p0.6 is disabled when this bit is set. 5 pinmap0.5 0 the weak pull-up on p0.5 is disabled when this bit is set. 4 pinmap0.4 0 the weak pull-up on p0.4 is disabled when this bit is set. 3 pinmap0.3 0 the weak pull-up on p0.3 is disabled when this bit is set. 2 pinmap0.2 0 the weak pull-up on p0.2 is disabled when this bit is set. 1 pinmap0.1 0 the weak pull-up on p0.1 is disabled when this bit is set. 0 pinmap0.0 0 the weak pull-up on p0.0 is disabled when this bit is set. table 158. port 1 weak pull-up enable sfr (pinmap1, address 0xb3) bit mnemonic default description 7 pinmap1.7 0 the weak pull-up on p1.7 is disabled when this bit is set. 6 pinmap1.6 0 the weak pull-up on p1.6 is disabled when this bit is set. 5 pinmap1.5 0 the weak pull-up on p1.5 is disabled when this bit is set. 4 pinmap1.4 0 the weak pull-up on p1.4 is disabled when this bit is set. 3 pinmap1.3 0 the weak pull-up on p1.3 is disabled when this bit is set. 2 pinmap1.2 0 the weak pull-up on p1.2 is disabled when this bit is set. 1 pinmap1.1 0 the weak pull-up on p1.1 is disabled when this bit is set. 0 pinmap1.0 0 the weak pull-up on p1.0 is disabled when this bit is set. table 159. port 2 weak pull-up enable sfr (pinmap2, address 0xb4) bit mnemonic default description [7:6] reserved 0 reserved. should be left cleared. 5 pinmap2.5 0 the weak pull-up on reset is disabled when this bit is set. 4 reserved 0 reserved. should be left cleared. 3 pinmap2.3 0 reserved. should be left cleared. 2 pinmap2.2 0 the weak pull-up on p2.2 is disabled when this bit is set. 1 pinmap2.1 0 the weak pull-up on p2.1 is disabled when this bit is set. 0 pinmap2.0 0 the weak pull-up on p2.0 is disabled when this bit is set.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 144 of 1 52 table 160. port 0 sfr (p0, address 0x80) bit bit address mnemonic default description 1 7 0x87 t1 1 this bit reflects the state of the p0.7/ ss /t1 pin. it can be written to or read. 6 0x86 t0 1 this bit reflects the state of the p0 .6/sclk/t0 pin. it can be written to or read. 5 0x85 1 this bit reflects the state of the p0.5/miso pin. it can be written to or read. 4 0x84 1 this bit reflects the state of the p0.4/mosi/sdata pin. it can be written to or read. 3 0x83 cf2 1 this bit reflects the state of the p0.3/cf2 pin. it can be written to or read. 2 0x82 cf1 1 this bit reflects the state of the p0.2/cf1 pin. it can be written to or read. 1 0x81 1 this bit reflects the state of the p0.1/fp19 pin. it can be written to or read. 0 0x80 int1 1 this bit reflects the state of the bctrl/ int1 /p0.0 pin. it can be written to or read. 1 when an alternate function is chosen for a pin of this port, the bit controlling this pin should always be set. table 161. port 1 sfr (p1, address 0x90) bit bit address mnemonic default description 1 7 0x97 1 this bit reflects the state of the p1.7/fp20 pin. it can be written to or read. 6 0x96 1 this bit reflects the state of the p1.6/fp21 pin. it can be written to or read. 5 0x95 1 this bit reflects the state of the p1.5/fp22 pin. it can be written to or read. 4 0x94 t2 1 this bit reflects the state of the p1.4/t2/fp23 pin. it can be written to or read. 3 0x93 t2ex 1 this bit reflects the state of the p1 .3/t2ex/fp24 pin. it can be written to or read. 2 0x92 1 this bit reflects the state of the p1.2/fp25 pin. it can be written to or read. 1 0x91 txd 1 this bit reflects the state of the p1.1/txd pin. it can be written to or read. 0 0x90 rxd 1 this bit reflects the state of the p1.0/rxd pin. it can be written to or read. 1 when an alternate function is chosen for a pin of this port, the bit controlling this pin should always be set. table 162. port 2 sfr (p2, address 0xa0) bit bit address mnemonic default description 1 [7:4] 0x97 to 0x94 0x1f these bits are unused and should remain set. 3 0x93 p2.3 1 this bit reflects the state of the p2.3/sden pin. it can be written only. 2 0x92 p2.2 1 this bit reflects the state of the p2.2/fp16 pin. it can be written to or read. 1 0x91 p2.1 1 this bit reflects the state of the p2.1/fp17 pin. it can be written to or read. 0 0x90 p2.0 1 this bit reflects the state of the p2.0/fp18 pin. it can be written to or read. 1 when an alternate function is chosen for a pin of this port, the bit controlling this pin should always be set.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 145 of 1 52 table 163. port 0 alternate functions pin no. alternate function alternate function enable p0.0 bctrl external battery control input set int1prog = x01 in the interrupt pins configuration sfr (intpr, address 0xff). int1 external interrupt set ex1 in the interrupt enable sfr (ie, address 0xa8). int1 wake-up from psm2 operating mode set int1prog = 11x in the interrupt pins configuration sfr (intpr, address 0xff). p0.1 fp19 lcd segment pin set fp19en in the lcd segment enable 2 sfr (lcdsege2, address 0xed). p0.2 cf1 ade calibration frequency output clear the discf1 bit in the ade energy measurement internal mode1 register (address 0x0b). p0.3 cf2 ade calibration frequency output clear the discf2 bit in the ade energy measurement internal mode1 register (address 0x0b). p0.4 mosi spi data line set the scps bit in the configuration sfr (cfg, address 0xaf) and set the spien bit in the spi configuration sfr 2 (spimod2, address 0xe9). sdata i 2 c data line clear the scps bit in the configuratio n sfr (cfg, address 0xaf) and set the i2cen bit in the i 2 c mode sfr (i2cmod, address 0xe8). p0.5 miso spi data line set the scps bit in the configuration sfr (cfg, address 0xaf) and set the spien bit in the spi configuration sfr 2 (spimod2, address 0xe9). p0.6 sclk serial clock for i 2 c or spi set the i2cen bit in the i 2 c mode sfr (i2cmod, address 0xe8) or the spien bit in the spi configuration sfr 2 (spimod2, address 0xe9) to enable the i 2 c or spi interface. t0 timer 0 input set the c/ t0 bit in the timer/counter 0 and timer/counter 1 mode sfr (tmod, address 0x89) to enable t0 as an external event counter. p0.7 ss spi slave select input for spi in slave mode set the ss_en bit in the spi configur ation sfr 1 (spimod1, address 0xe8). ss spi slave select output for spi in master mode set the spims_b bit in the spi configuration sfr 2 (spimod2, address 0xe9). t1 timer 1 input set the c/ t1 bit in the timer/counter 0 and timer/counter 1 mode sfr (tmod, address 0x89) to enable t1 as an external event counter. table 164. port 1 alternate functions pin no. alternate function alternate function enable p1.0 rxd receiver data input for uart set the ren bit in the serial communicat ions control register bit description sfr (scon, address 0x98). rx edge wake-up from psm2 operating mode set rxprog[1:0] = 11 in the peripheral configuration sfr (periph, address 0xf4). p1.1 txd transmitter data output for uart this pin be comes txd as soon as data is written into sbuf. p1.2 fp25 lcd segment pin set fp25en in the lcd segment enable sfr (lcdsege, address 0x97). p1.3 fp24 lcd segment pin set fp24en in the lcd segment enable sfr (lcdsege, address 0x97). t2ex timer 2 control input set exen2 in the timer/counter 2 control sfr (t2con, address 0xc8). p1.4 fp23 lcd segment pin set fp23en in the lcd segment enable sfr (lcdsege, address 0x97). t2 timer 2 input set the c/ t2 bit in the timer/counter 2 control sfr (t2con, address 0xc8) to enable t2 as an external event counter. p1.5 fp22 lcd segment pin set fp22en in the lcd segment enable sfr (lcdsege, address 0x97). p1.6 fp21 lcd segment pin set fp21en in the lcd segment enable sfr (lcdsege, address 0x97). p1.7 fp20 lcd segment pin set fp20en in the lcd segment enable sfr (lcdsege, address 0x97). table 165. port 2 alternate functions pin no. alternate function alternate function enable p2.0 fp18 lcd segment pin set fp18en in the lcd segment enable 2 sfr (lcdsege2, address 0xed). p2.1 fp17 lcd segment pin set fp17en in the lcd segment enable 2 sfr (lcdsege2, address 0xed). p2.2 fp16 lcd segment pin set fp16en in the lcd segment enable 2 sfr (lcdsege2, address 0xed). p2.3 sden serial download pin sampled on reset. p2.3 is an output only. enabled by default.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 146 of 152 port 0 port 0 is controlled directly through the bit-addressable port 0 sfr (p0, address 0x80). the weak internal pull-ups for port 0 are configured through the port 0 weak pull-up enable sfr (pinmap0, address 0xb2); they are enabled by default. the weak internal pull-up is disabled by writing a 1 to pinmap0.x. port 0 pins also have various secondary functions, as described in table 163. the alternate functions of port 0 pins can be activated only if the corresponding bit latch in the port 0 sfr contains a 1. otherwise, the port pin remains at 0. port 1 port 1 is an 8-bit bidirectional port controlled directly through the bit-addressable port 1 sfr (p1, address 0x90). the weak internal pull-ups for port 1 are configured through the port 1 weak pull-up enable sfr (pinmap1, address 0xb3); they are enabled by default. the weak internal pull-up is disabled by writing a 1 to pinmap1.x. port 1 pins also have various secondary functions as described in table 164. the alternate functions of port 1 pins can be activated only if the corresponding bit latch in the port 1 sfr contains a 1. otherwise, the port pin remains at 0. port 2 port 2 is a 4-bit bidirectional port controlled directly through the bit-addressable port 2 sfr (p2, address 0xa0). note that p2.3 can be used as an output only. consequently, any read operation, such as a cpl p2.3, cannot be executed on this i/o. the weak internal pull-ups for port 2 are configured through the port 2 weak pull-up enable sfr (pinmap2, address 0xb4); they are enabled by default. the weak internal pull-up is disabled by writing a 1 to pinmap2.x. port 2 pins also have various secondary functions as described in table 165. the alternate functions of port 2 pins can be activated only if the corresponding bit latch in the port 2 sfr contains a 1. otherwise, the port pin remains at 0.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 147 of 1 52 determining the version of the part each ADE7116/ade7156/ade7166/ade7169/ade7566/ ade7569 holds in its internal flash registers a value that defines its version. this value helps to determine whether users have the latest version of the part. the version of the ADE7116/ade7156/ ade7166/ade7169/ade7566/ade7569 that corresponds to this data sheet is ADE7116/ade7156/ade7166/ade7169/ ade7566/ade7569 v3.4. this value can be accessed as follows: 1. launch hyperterminal with a 9600 baud rate. 2. put the part in serial download mode by first holding sden to logic low, then resetting the part. 3. hold the sden pin. 4. press and release the reset pin. a string should appear on the hyperterminal screen containing the part name and version number, for example, ADE7116v3.4, ade7156v3.4, ade7166v3.4, ade7169v3.4, ade7566v3.4, or ade7569v3.4.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 148 of 1 52 outline dimensions compliant to jedec standards ms-026-bcd 051706-a top view (pins down) 1 16 17 33 32 48 49 64 0.27 0.22 0.17 0.50 bsc lead pitch 12.20 12.00 sq 11.80 pin 1 1.60 max 0.75 0.60 0.45 10.20 10.00 sq 9.80 view a 0.20 0.09 1.45 1.40 1.35 0.08 coplanarity view a rotated 90 ccw seating plane 0.15 0.05 7 3.5 0 figure 118. 64-lead low profile quad flat package [lqfp] (st-64-2) dimensions shown in millimeters pin 1 indicator top view 8.75 bsc sq 9.00 bsc sq 1 64 16 17 49 48 32 33 0.50 0.40 0.30 0.50 bsc 0.20 ref 12 max 0.80 max 0.65 typ 1.00 0.85 0.80 7.50 ref 0.05 max 0.02 nom 0.60 max 0.60 max * 4.85 4.70 sq 4.55 exposed pad (bottom view) * compliant to jedec standards mo-220-vmmd-4 except for exposed pad dimension 082908-b seating plane pin 1 indicator 0.30 0.25 0.18 for proper connection of the exposed pad, refer to the pin configuration and function descriptions section of this data sheet. figure 119. 64-lead lead frame chip scale package [lfcsp_vq] 9 mm 9 mm body, very thin quad (cp-64-1) dimensions shown in millimeters
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 149 of 1 52 ordering guide model 1 anti- tamper di/dt sensor interface var flash (kb) temperature range package description package option ADE7116astzf16 2 , 3 , 4 yes no no 16 ?40c to +85c 64-lead lqfp st-64-2 ADE7116astzf16-rl 2 , 3 , 4 no no no 16 ?40c to +85c 64-lead lqfp, reel st-64-2 ADE7116astzf8 2 , 3 , 4 yes no no 8 ?40c to +85c 64-lead lqfp st-64-2 ADE7116astzf8-rl 2 , 3 , 4 no no no 8 ?40c to +85c 64-lead lqfp, reel st-64-2 ade7156astzf16 2 , 4 yes no no 16 ?40c to +85c 64-lead lqfp st-64-2 ade7156astzf16-rl 2 , 4 yes no no 16 ?40c to +85c 64-lead lqfp, reel st-64-2 ade7156astzf8 2 , 4 yes no no 8 ?40c to +85c 64-lead lqfp st-64-2 ade7156astzf8-rl 2 , 4 yes no no 8 ?40c to +85c 64-lead lqfp, reel st-64-2 ade7166acpzf8 2 yes no no 8 ?40c to +85c 64-lead lfcsp_vq cp-64-1 ade7166acpzf8-rl 2 yes no no 8 ?40c to +85c 64-lead lfcsp_vq, reel cp-64-1 ade7166acpzf16 2 yes no no 16 ?40c to +85c 64-lead lfcsp_vq cp-64-1 ade7166acpzf16-rl 2 yes no no 16 ?40c to +85c 64-lead lfcsp_vq, reel cp-64-1 ade7166astzf8 2 yes no no 8 ?40c to +85c 64-lead lqfp st-64-2 ade7166astzf8-rl 2 yes no no 8 ?40c to +85c 64-lead lqfp, reel st-64-2 ade7166astzf16 2 yes no no 16 ?40c to +85c 64-lead lqfp st-64-2 ade7166astzf16-rl 2 yes no no 16 ?40c to +85c 64-lead lqfp, reel st-64-2 ade7169acpzf16 2 yes yes yes 16 ?40c to +85c 64-lead lfcsp_vq cp-64-1 ade7169acpzf16-rl 2 yes yes yes 16 ?40c to +85c 64-lead lfcsp_vq, reel cp-64-1 ade7169astzf8 2 yes yes yes 8 ?40c to +85c 64-lead lqfp st-64-2 ade7169astzf8-rl 2 yes yes yes 8 ?40c to +85c 64-lead lqfp, reel st-64-2 ade7169astzf16 2 yes yes yes 16 ?40c to +85c 64-lead lqfp st-64-2 ade7169astzf16-rl 2 yes yes yes 16 ?40c to +85c 64-lead lqfp, reel st-64-2 ade7566acpzf8 2 no no no 8 ?40c to +85c 64-lead lfcsp_vq cp-64-1 ade7566acpzf8-rl 2 no no no 8 ?40c to +85c 64-lead lfcsp_vq, reel cp-64-1 ade7566acpzf16 2 no no no 16 ?40c to +85c 64-lead lfcsp_vq cp-64-1 ade7566acpzf16-rl 2 no no no 16 ?40c to +85c 64-lead lfcsp_vq, reel cp-64-1 ade7566astzf8 2 no no no 8 ?40c to +85c 64-lead lqfp st-64-2 ade7566astzf8-rl 2 no no no 8 ?40c to +85c 64-lead lqfp, reel st-64-2 ade7566astzf16 2 no no no 16 ?40c to +85c 64-lead lqfp st-64-2 ade7566astzf16-rl 2 no no no 16 ?40c to +85c 64-lead lqfp, reel st-64-2 ade7569acpzf16 2 no yes yes 16 ?40c to +85c 64-lead lfcsp_vq cp-64-1 ade7569acpzf16-rl 2 no yes yes 16 ?40c to +85c 64-lead lfcsp_vq, reel cp-64-1 ade7569astzf8 2 no yes yes 8 ?40c to +85c 64-lead lqfp st-64-2 ade7569astzf8-rl 2 no yes yes 8 ?40c to +85c 64-lead lqfp, reel st-64-2 ade7569astzf16 2 no yes yes 16 ?40c to +85c 64-lead lqfp st-64-2 ade7569astzf16-rl 2 no yes yes 16 ?40c to +85c 64-lead lqfp, reel st-64-2 ade8052z-prg1 2 ade programmer ade8052z-dwdl1 2 ade downloader ade8052z-emul1 2 ade emulator eval-ade7169f16ebz 2 evaluation board eval-ade7569f16ebz 2 evaluation board 1 all models have w + va + rms, 5 v lcd, and rtc. 2 z = rohs compliant part. 3 the ADE7116 does not su pport battery and temperat ure adc measurements. 4 the ADE7116 and the ade7156 do not have internally adjust able lcd levels.
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 150 of 15 2 notes
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 151 of 15 2 notes
ADE7116/ade7156/ade7166/ade7169/ade7566/ade7569 rev. b | page 152 of 152 notes purchase of licensed i 2 c components of analog devices or one of its sublicensed associated companies conveys a license for the purchaser under the phi lips i 2 c patent rights to use these components in an i 2 c system, provided that the system conforms to the i 2 c standard specification as defined by philips. ?2007C2008 analog devices, inc. all rights reserved. trademarks and registered trademarks are the prop erty of their respective owners. d06353-0-11/08(b)


▲Up To Search▲   

 
Price & Availability of ADE7116

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X